plynx.base.executor

Templates for PLynx Executors and utils.

Module Contents

class plynx.base.executor.RunningStatus[source]

Async job running status

node_running_status :str[source]
class plynx.base.executor.BaseExecutor(node: Optional[Node] = None)[source]

Bases: abc.ABC

Base Executor class

IS_GRAPH :bool = False[source]
_update_node(self, node)[source]
run(self, preview: bool = False)[source]

Main execution function.

  • Workdir has been initialized.
  • Inputs are not preprocessed.
  • Outputs shoul be manually postprocessed.
  • It is OK to raise an exception in this function.
Returns:
enum: plynx.constants.NodeRunningStatus
launch(self)[source]

Launch the Node on the backend.

The difference between launch() and run() is that: - run() assumes synchronous execution. - launch() does not necessary have this assumtion. Use get_node_running_status to get the status of the execution.

Returns:
RunningStatus
get_running_status(self)[source]

Returns the status of the execution.

Async executions should sync with the remote and return the result immediately.

kill(self)[source]

Force to kill the process.

The reason can be the fact it was working too long or parent executor canceled it.

is_updated(self)[source]

Function that is regularly called by a Worker.

The function is running in a separate thread and does not block execution of run().

Returns:
(bool): True if worker needs to update DB else False
classmethod get_default_node(cls, is_workflow: bool)[source]

Generate a new default Node for this executor

init_executor(self)[source]

Initialize environment for the executor

clean_up_executor(self)[source]

Clean up the environment created by executor

validate(self, ignore_inputs: bool = True)[source]

Validate Node.

Return:
(ValidationError) Validation error if found; else None
class plynx.base.executor.Dummy[source]

Bases: plynx.base.executor.BaseExecutor

Dummy Executor. Used for static Operations

run(self, preview=False)[source]

Not Implemented

status(self)[source]

Not Implemented

kill(self)[source]

Not Implemented

classmethod get_default_node(cls, is_workflow: bool)[source]

Not Implemented