worker_node.worker_node_task_instance

The Task Instance Object once it has been submitted to run on a worker node.

Attributes

logger

Classes

WorkerNodeTaskInstance

The Task Instance object once it has been submitted to run on a worker node.

Module Contents

worker_node.worker_node_task_instance.logger[source]
class worker_node.worker_node_task_instance.WorkerNodeTaskInstance(cluster_interface: jobmon.core.cluster_protocol.ClusterWorkerNode, task_instance_id: int, task_instance_heartbeat_interval: int | None = None, heartbeat_report_by_buffer: float | None = None, command_interrupt_timeout: int | None = None, requester: jobmon.core.requester.Requester | None = None)[source]

The Task Instance object once it has been submitted to run on a worker node.

_task_instance_id[source]
requester = None[source]
cluster_interface[source]
_distributor_id[source]
_status: str | None = None[source]
_command: str | None = None[source]
_command_add_env: Dict[str, str] | None = None[source]
_stdout: str | None = None[source]
_stderr: str | None = None[source]
last_heartbeat_time[source]
property task_instance_id: int[source]

Returns a task instance ID if it’s been bound.

property distributor_id: str | None[source]

Executor id given from the executor it is being run on.

property nodename: str | None[source]

Node it is being run on.

property process_group_id: int | None[source]

Process group to track parent and child processes.

property status: str[source]

Returns the last known status of the task instance.

property stdout: str[source]
property stderr: str[source]
property command: str[source]

Returns the command this task instance will run.

property command_add_env: Dict[str, str][source]

Returns the command this task instance will run.

property command_returncode: int[source]

Returns the exit code of the command that was run.

property command_stdout: str[source]

Returns the last 10k characters of the commands stdout.

property command_stderr: str[source]

Returns the last 10k characters of the commands stderr.

log_done() None[source]

Tell the JobStateManager that this task_instance is done.

log_error(error_state: str, description: str) None[source]

Tell the JobStateManager that this task_instance has errored.

log_running() None[source]

Tell the JobStateManager that this task_instance is running.

Update the report_by_date to be further in the future in case it gets reconciled immediately.

log_report_by() None[source]

Log the heartbeat to show that the task instance is still alive.

run() None[source]

This script executes on the target node and wraps the target application.

Could be in any language, anything that can execute on linux. Similar to a stub or a container set ENV variables in case tasks need to access them.

set_command_output(returncode: int, stdout: str, stderr: str) None[source]
static _communicate(async_stream: asyncio.StreamReader, output_stream: TextIO, chunk_size: int = 64) str[source]
Async:

async _process_poller(process: asyncio.subprocess.Process) int[source]
async _run_cmd() None[source]