AYON Bin Bridge Client  0.1.0
Loading...
Searching...
No Matches
ayon_bin_distro.work_handler.worker.WorkItem Class Reference
Collaboration diagram for ayon_bin_distro.work_handler.worker.WorkItem:

Public Member Functions

def __init__ (self, Callable[[Any], Any] func, Optional[List[Any]] args=[], dict kwargs={}, Union[BaseProgressItem, ProgressItem] progress_item_instance=BaseProgressItem(), Optional[List[uuid.UUID]] dependency_id=None)
 
def id (self)
 
def get_uuid (self)
 
def connect_func_return (self)
 
def func_return (self, float check_delay=0.1)
 
def get_progress_item (self)
 
def start (self)
 

Public Attributes

 dependency_id
 

Private Attributes

 _id
 
 _progress_item
 
 _func
 
 _args
 
 _kwargs
 
 _func_return
 

Detailed Description

WorkItem will hold a single function and its dependency's in order to allow organized parallel execution via the Controler class.
the WorkItem can have an optional ProgressItem attached to it if progress should be reported

Attributes:
    func: Callable[..., Any] = this will be the function that gets executed
    args: = func() arguments
    kwargs: = func() kwargs
    progress: Optional[ProgressItem] = optional progress object to report back to.
    dependenct_id: optional list off ids from a different work item that this work item depends on.

Constructor & Destructor Documentation

◆ __init__()

def ayon_bin_distro.work_handler.worker.WorkItem.__init__ (   self,
Callable[[Any], Any]  func,
Optional[List[Any]]   args = [],
dict   kwargs = {},
Union[ BaseProgressItem, ProgressItem ]   progress_item_instance = BaseProgressItem(),
Optional[List[uuid.UUID]]   dependency_id = None 
)

Member Function Documentation

◆ connect_func_return()

def ayon_bin_distro.work_handler.worker.WorkItem.connect_func_return (   self)
this function returns what ever the WorkItem._func returns. but its not blocking. it exists so you can have a dependent WorkItem that can use the function return as a value.

Returns:

◆ func_return()

def ayon_bin_distro.work_handler.worker.WorkItem.func_return (   self,
float   check_delay = 0.1 
)
this is a blocking function that checks the return off self._func() in a while loop.
This function dose not care if the item has been started


Returns: if failed: -1, if finished: func()->Return[Any]

◆ get_progress_item()

def ayon_bin_distro.work_handler.worker.WorkItem.get_progress_item (   self)
get the connected process item

Returns: Union[BaseProgressItem, ProgressItem]

◆ get_uuid()

def ayon_bin_distro.work_handler.worker.WorkItem.get_uuid (   self)
get the UUID objectg of this work instance

Returns: UUID

◆ id()

def ayon_bin_distro.work_handler.worker.WorkItem.id (   self)
get the hex representation of the UUID of this work instance

Returns: UUID.hex

◆ start()

def ayon_bin_distro.work_handler.worker.WorkItem.start (   self)
starts the execution of this work item an starts reporting information to the connected ProgressItem

Member Data Documentation

◆ _args

ayon_bin_distro.work_handler.worker.WorkItem._args
private

◆ _func

ayon_bin_distro.work_handler.worker.WorkItem._func
private

◆ _func_return

ayon_bin_distro.work_handler.worker.WorkItem._func_return
private

◆ _id

ayon_bin_distro.work_handler.worker.WorkItem._id
private

◆ _kwargs

ayon_bin_distro.work_handler.worker.WorkItem._kwargs
private

◆ _progress_item

ayon_bin_distro.work_handler.worker.WorkItem._progress_item
private

◆ dependency_id

ayon_bin_distro.work_handler.worker.WorkItem.dependency_id

The documentation for this class was generated from the following file: