scistag.remotestag.service_task.RemoteTask¶
- class RemoteTask(task_id, service, target_function, parameters, timeout_s=-1.0)[source]¶
Bases:
objectThis function handles the execution of a remotely executed function
- Parameters
Methods
Assigns an error to the result
Assigns the result to the task
Returns the time when this task becomes invalid
Returns the error string if an error occurred
Returns the task's unique ID
Returns the parameters passed into the function
Returns the task's result
Returns the service being required for this task
Returns the target function
Unwraps the result dictionary to a single value if it just contains a single value
Waits for the finishing of the execution up to a given timeout
Attributes
ERROR__dict____doc____module____weakref__list of weak references to the object (if defined)
The task's unique id
The service which provides the function
The identifier of the function to call
Data access lock
The even to be triggered to wake up sleeping receivers
The function's parameters
The function's result
Interval of sleep
The timeout time
- assign_error(error)[source]¶
Assigns an error to the result
- Parameters
error (
str) – The error string
- get_deprecation_time()[source]¶
Returns the time when this task becomes invalid
- Return type
- Returns
The deprecation time (see time.time()). If -1 the task does not deprecate.
- get_error()[source]¶
Returns the error string if an error occurred
- Return type
str | None
- Returns
The error string
- get_result()[source]¶
Returns the task’s result
- Return type
dict | None
- Returns
The result data (if it’s available already)
- get_service()[source]¶
Returns the service being required for this task
- Return type
- Returns
The service
- get_target_function()[source]¶
Returns the target function
- Return type
- Returns
The function’s identifier
- unwrap()[source]¶
Unwraps the result dictionary to a single value if it just contains a single value
- Return type
RemoteReturnTypes | None
- Returns
A dictionary in case of multiple return values otherwise the single value
- wait(timeout_s=-1)[source]¶
Waits for the finishing of the execution up to a given timeout
- Parameters
timeout_s – The maximum waiting time in seconds
- Return type
- Returns
True if the data is available
- _access_lock¶
Data access lock
- _event¶
The even to be triggered to wake up sleeping receivers
- _service¶
The service which provides the function
- _sleep_interval¶
Interval of sleep
- _task_id¶
The task’s unique id
- timeout_s¶
The timeout time