spinetoolbox.spine_engine_manager
Contains SpineEngineManagerBase.
Module Contents
Classes
Responsible for remote project execution. |
Functions
|
Returns either a Local or a remote Spine Engine Manager based on settings. |
- class spinetoolbox.spine_engine_manager.SpineEngineManagerBase[source]
- abstract run_engine(engine_data)[source]
Runs an engine with given data.
- Parameters
engine_data (dict) – The engine data.
- abstract get_engine_event()[source]
Gets next event from a running engine.
- Returns
two element tuple: event type identifier string, and event data dictionary
- Return type
tuple(str,dict)
- abstract answer_prompt(prompter_id, answer)[source]
Answers prompt.
- Parameters
prompter_id (int) – The id of the prompter
answer – The user’s decision.
- abstract restart_kernel(connection_file)[source]
Restarts the jupyter kernel associated to given connection file.
- Parameters
connection_file (str) – path of connection file
- abstract shutdown_kernel(connection_file)[source]
Shuts down the jupyter kernel associated to given connection file.
- Parameters
connection_file (str) – path of connection file
- abstract issue_persistent_command(persistent_key, command)[source]
Issues a command to a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
command (str) – command to issue
- Returns
stdin, stdout, and stderr messages (dictionaries with two keys: type, and data)
- Return type
generator
- abstract is_persistent_command_complete(persistent_key, command)[source]
Checks whether a command is complete.
- Parameters
key (tuple) – persistent identifier
cmd (str) – command to issue
- Returns
bool
- abstract restart_persistent(persistent_key)[source]
Restarts a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
- Returns
stdout and stderr messages (dictionaries with two keys: type, and data)
- Return type
generator
- abstract interrupt_persistent(persistent_key)[source]
Interrupts a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
- abstract kill_persistent(persistent_key)[source]
Kills a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
- class spinetoolbox.spine_engine_manager.LocalSpineEngineManager[source]
Bases:
SpineEngineManagerBase
- run_engine(engine_data)[source]
Runs an engine with given data.
- Parameters
engine_data (dict) – The engine data.
- get_engine_event()[source]
Gets next event from a running engine.
- Returns
two element tuple: event type identifier string, and event data dictionary
- Return type
tuple(str,dict)
- answer_prompt(prompter_id, answer)[source]
Answers prompt.
- Parameters
prompter_id (int) – The id of the prompter
answer – The user’s decision.
- restart_kernel(connection_file)[source]
Restarts the jupyter kernel associated to given connection file.
- Parameters
connection_file (str) – path of connection file
- shutdown_kernel(connection_file)[source]
Shuts down the jupyter kernel associated to given connection file.
- Parameters
connection_file (str) – path of connection file
- issue_persistent_command(persistent_key, command)[source]
Issues a command to a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
command (str) – command to issue
- Returns
stdin, stdout, and stderr messages (dictionaries with two keys: type, and data)
- Return type
generator
- is_persistent_command_complete(persistent_key, command)[source]
Checks whether a command is complete.
- Parameters
key (tuple) – persistent identifier
cmd (str) – command to issue
- Returns
bool
- restart_persistent(persistent_key)[source]
Restarts a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
- Returns
stdout and stderr messages (dictionaries with two keys: type, and data)
- Return type
generator
- interrupt_persistent(persistent_key)[source]
Interrupts a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
- kill_persistent(persistent_key)[source]
Kills a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
- class spinetoolbox.spine_engine_manager.RemoteSpineEngineManager(job_id='')[source]
Bases:
SpineEngineManagerBase
Responsible for remote project execution.
Initializer.
- make_engine_client(host, port, security, sec_folder, ping=True)[source]
Creates a client for connecting to Spine Engine Server.
- run_engine(engine_data)[source]
Makes an engine client for communicating with the engine server. Starts a thread for monitoring the DAG execution on server.
- Parameters
engine_data (dict) – The engine data.
- stop_engine()[source]
Sends a request to stop execution on Server then waits for _runner thread to end.
- _run()[source]
Sends a start execution request to server with the job Id. Sets up a subscribe socket according to the publish port received from server. Passes received events to SpineEngineWorker for processing. After execution has finished, downloads new files from server.
- is_persistent_command_complete(persistent_key, command)[source]
Checks whether a command is complete.
- Parameters
key (tuple) – persistent identifier
cmd (str) – command to issue
- Returns
bool
- issue_persistent_command(persistent_key, command)[source]
Issues a command to a persistent process.
- Parameters
persistent_key (tuple) – persistent identifier
command (str) – command to issue
- Returns
stdin, stdout, and stderr messages (dictionaries with two keys: type, and data)
- Return type
generator
- spinetoolbox.spine_engine_manager.make_engine_manager(remote_execution_enabled=False, job_id='')[source]
Returns either a Local or a remote Spine Engine Manager based on settings.
- Parameters
remote_execution_enabled (bool) – True returns a local Spine Engine Manager instance,
instance (False returns a remote Spine Engine Manager) –
job_id (str) – Server execution job Id