scistag.remotestag.service_handler.RemoteServiceHandler¶
- class RemoteServiceHandler[source]¶
Bases:
objectOrchestrates the single services and their associated execution resources
Methods
Initiates the asynchronous execution of a function :type identifier:
str:param identifier: The function's identifier :type parameters:Union[dict,str,float,bool,int,bytes] :param parameters: The function parameters :type timeout_s:float:param timeout_s: The timeout in seconds.Flags a task as done :type task:
RemoteTask:param task: The task to flag as doneReturns the default remote handler
Returns the count of tasks which are in progress :rtype:
int:return: The count of tasks in progressTries to find a suitable task for the list of supported services.
Returns the count of tasks waiting on the to do list :rtype:
int:return: The count of tasks which did not start yetRegisters a new service :type service:
RemoteService:param service: The new serviceInitiates the handler :rtype:
bool:return: True on successStops the handler :rtype:
bool:return: True on successAttributes
__annotations____dict____doc____module____weakref__list of weak references to the object (if defined)
The singleton default handler
Call id counter
Tasks to be executed
Tasks in progress
- __start_workers()¶
Winds up all worker threads
- __stop_workers()¶
Stop and join all workers
- execute_async(identifier, parameters, timeout_s=-1.0)[source]¶
Initiates the asynchronous execution of a function :type identifier:
str:param identifier: The function’s identifier :type parameters:Union[dict,str,float,bool,int,bytes] :param parameters: The function parameters :type timeout_s:float:param timeout_s: The timeout in seconds. Very recommended in case you access this service from the web. :rtype:RemoteTask:return: The task to retrieve the result with
- flag_as_done(task)[source]¶
Flags a task as done :type task:
RemoteTask:param task: The task to flag as done
- get_in_progress()[source]¶
Returns the count of tasks which are in progress :rtype:
int:return: The count of tasks in progress
- get_task(identifier_set)[source]¶
Tries to find a suitable task for the list of supported services. Moves the task internal from to do to in progress :param identifier_set: The supported services :rtype: RemoteTask | None :return: A new task if one is available.
- get_todo()[source]¶
Returns the count of tasks waiting on the to do list :rtype:
int:return: The count of tasks which did not start yet
- register_service(service)[source]¶
Registers a new service :type service:
RemoteService:param service: The new service- Return type
- _call_counter¶
Call id counter
- _in_progress¶
Tasks in progress
- _todo¶
Tasks to be executed
- default_handler: RemoteServiceHandler = <scistag.remotestag.service_handler.RemoteServiceHandler object>¶
The singleton default handler