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

Public Member Functions

def __init__ (self)
 
def get_progress_items (self)
 
def work_finished (self)
 
WorkItem construct_work_item (self, Callable[[Any], Any] func, Optional[List[Any]] args=[], Dict[Any, Any] kwargs={}, Optional[List[uuid.UUID]] dependency_id=None, Optional[str] icon_path=None, Optional[str] progress_title=None)
 
def add_work_item (self, WorkItem work_item_instance)
 
def start (self)
 
def is_running (self)
 

Private Member Functions

bool _can_item_be_run (self, str work_item_id_hex)
 
def _start_main_loop (self)
 

Private Attributes

 _work_started
 
 _work_finished
 
 _main_thread
 

Constructor & Destructor Documentation

◆ __init__()

def ayon_bin_distro.work_handler.worker.Controller.__init__ (   self)
work controller class that organises and starts WorkItem's according to their dependencoes grouped on separated threads depending on their dependencies

Member Function Documentation

◆ _can_item_be_run()

bool ayon_bin_distro.work_handler.worker.Controller._can_item_be_run (   self,
str  work_item_id_hex 
)
private
this function checks if an work_item has dependency's that has not finished running

◆ _start_main_loop()

def ayon_bin_distro.work_handler.worker.Controller._start_main_loop (   self)
private
Start WorkItem's groups by dependency and start the groups on separate threads

◆ add_work_item()

def ayon_bin_distro.work_handler.worker.Controller.add_work_item (   self,
WorkItem  work_item_instance 
)
allows adding a manually created WorkItem instance to the Controller

Args:
    work_item_instance: WorkItem instance

◆ construct_work_item()

WorkItem ayon_bin_distro.work_handler.worker.Controller.construct_work_item (   self,
Callable[[Any], Any]  func,
Optional[List[Any]]   args = [],
Dict[Any, Any]   kwargs = {},
Optional[List[uuid.UUID]]   dependency_id = None,
Optional[str]   icon_path = None,
Optional[str]   progress_title = None 
)
generates a WorkItem instance and adds it to the current Controller instance

Args:
    func: function that should be called in the work item
    args: args for the function
    kwargs: named args for the function
    dependency_id: list of UUID's off WorkItem instances that this WorkItem depends on
    icon_path: path for an icon that should be displayed in the GUI (a ProgressItem will be created for the work item if icon_path and progress_title are present if not an BaseProgressItem)
    progress_title: title for the Progress bar to show in the GUI (a ProgressItem will be created for the work item if icon_path and progress_title are present if not an BaseProgressItem)

Returns: WorkItem instance that has been added to the Controller instance

◆ get_progress_items()

def ayon_bin_distro.work_handler.worker.Controller.get_progress_items (   self)
returns a list off progress items that can be read out in order to get the progress per object

Yields: List[ProgressItem or BaseProgressItem]

◆ is_running()

def ayon_bin_distro.work_handler.worker.Controller.is_running (   self)
check if the current Controller has running WorkItems

Returns: true if there is one or more running WorkItems

◆ start()

def ayon_bin_distro.work_handler.worker.Controller.start (   self)
Start execution off all work items.
the _start_main_loop function is called to a different thread so this function will not block further execution

◆ work_finished()

def ayon_bin_distro.work_handler.worker.Controller.work_finished (   self)
check if all WorkItem`s have finished

Returns: bool true if all WorkItem's have finished

Member Data Documentation

◆ _main_thread

ayon_bin_distro.work_handler.worker.Controller._main_thread
private

◆ _work_finished

ayon_bin_distro.work_handler.worker.Controller._work_finished
private

◆ _work_started

ayon_bin_distro.work_handler.worker.Controller._work_started
private

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