tron.actioncommand module¶
- class tron.actioncommand.ActionCommand(id, command, serializer=None)¶
Bases:
ObservableAn ActionCommand encapsulates a runnable task that is passed to a node for execution.
- A Node calls:
started (when the command starts) exited (when the command exits) write_<channel> (when output is received) done (when the command is finished)
- COMPLETE = 'complete'¶
- EXITING = 'exiting'¶
- FAILSTART = 'failstart'¶
- PENDING = 'pending'¶
- RUNNING = 'running'¶
- STATE_MACHINE = <Machine S=pending T=(defaultdict(<class 'dict'>, {'pending': {'start': 'running', 'exit': 'failstart'}, 'running': {'exit': 'exiting'}, 'exiting': {'close': 'complete'}}))>¶
- STDERR = '.stderr'¶
- STDOUT = '.stdout'¶
- done()¶
- exited(exit_status)¶
- handle_errback(result)¶
Handle an unexpected error while being run. This will likely be an interval error. Cleanup the state of this ActionCommand and log something useful for debugging.
- property is_complete¶
Complete implies done and success.
- property is_done¶
Done implies no more work will be done, but might not be success.
- property is_failed¶
- property is_unknown¶
- started()¶
- property state¶
- transition_and_notify(target)¶
- write_stderr(value)¶
- write_stdout(value)¶
- class tron.actioncommand.NoActionRunnerFactory¶
Bases:
objectAction runner factory that does not wrap the action run command.
- classmethod build_stop_action_command(_id, _command)¶
It is not possible to stop action commands without a runner.
- classmethod create(id, command, serializer)¶
- static from_json()¶
- static to_json()¶
- class tron.actioncommand.StringBufferStore¶
Bases:
objectA serializer object which can be passed to ActionCommand as a serializer, but stores streams in memory.
- clear()¶
- open(name)¶
- class tron.actioncommand.SubprocessActionRunnerFactory(status_path, exec_path)¶
Bases:
PersistableRun actions by wrapping them in action_runner.py.
- build_command(id, command, exec_name)¶
- build_stop_action_command(id, command)¶
- create(id, command, serializer)¶
- classmethod from_config(config)¶
- static from_json(state_data: str) dict[str, Any]¶
- runner_exec_name = 'action_runner.py'¶
- status_exec_name = 'action_status.py'¶
- static to_json(state_data: dict) str¶
- tron.actioncommand.create_action_runner_factory_from_config(config)¶
A factory-factory method which returns a callable that can be used to create ActionCommand objects. The factory definition should match the constructor for ActionCommand.