jobflow_remote.utils.remote module#
Bases:
object
A singleton context manager to allow sharing the same host objects.
Hosts are stored internally, associated to the worker name Being a singleton, opening the context manager multiple times allows to share the hosts across different sections of the code, if needed. Hosts connections are all closed only when leaving the last context manager.
Examples
>>> with SharedHosts(project) as shared_hosts: ... host = shared_hosts.get_host("worker_name") ... # Use host as required
- Parameters:
project – The project configuration.
Close the connection to all the connected hosts
Return the shared host, if already defined, otherwise retrieve the host from the project and connect it.
- Parameters:
worker – The name of a worker defined in the project
- Returns:
The shared host.
- Return type: