worker_node.worker_node_task_instance ===================================== .. py:module:: worker_node.worker_node_task_instance .. autoapi-nested-parse:: The Task Instance Object once it has been submitted to run on a worker node. Attributes ---------- .. autoapisummary:: worker_node.worker_node_task_instance.logger Classes ------- .. autoapisummary:: worker_node.worker_node_task_instance.WorkerNodeTaskInstance Module Contents --------------- .. py:data:: logger .. py:class:: WorkerNodeTaskInstance(cluster_interface: jobmon.core.cluster_protocol.ClusterWorkerNode, task_instance_id: int, task_instance_heartbeat_interval: Optional[int] = None, heartbeat_report_by_buffer: Optional[float] = None, command_interrupt_timeout: Optional[int] = None, requester: Optional[jobmon.core.requester.Requester] = None) The Task Instance object once it has been submitted to run on a worker node. .. py:attribute:: _task_instance_id .. py:attribute:: requester :value: None .. py:attribute:: cluster_interface .. py:attribute:: _distributor_id .. py:attribute:: _status :type: Optional[str] :value: None .. py:attribute:: _command :type: Optional[str] :value: None .. py:attribute:: _command_add_env :type: Optional[Dict[str, str]] :value: None .. py:attribute:: _stdout :type: Optional[str] :value: None .. py:attribute:: _stderr :type: Optional[str] :value: None .. py:attribute:: last_heartbeat_time .. py:property:: task_instance_id :type: int Returns a task instance ID if it's been bound. .. py:property:: distributor_id :type: Optional[str] Executor id given from the executor it is being run on. .. py:property:: nodename :type: Optional[str] Node it is being run on. .. py:property:: process_group_id :type: Optional[int] Process group to track parent and child processes. .. py:property:: status :type: str Returns the last known status of the task instance. .. py:property:: stdout :type: str .. py:property:: stderr :type: str .. py:property:: command :type: str Returns the command this task instance will run. .. py:property:: command_add_env :type: Dict[str, str] Returns the command this task instance will run. .. py:property:: command_returncode :type: int Returns the exit code of the command that was run. .. py:property:: command_stdout :type: str Returns the last 10k characters of the commands stdout. .. py:property:: command_stderr :type: str Returns the last 10k characters of the commands stderr. .. py:method:: log_done() -> None Tell the JobStateManager that this task_instance is done. .. py:method:: log_error(error_state: str, description: str) -> None Tell the JobStateManager that this task_instance has errored. .. py:method:: log_running() -> None 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. .. py:method:: log_report_by() -> None Log the heartbeat to show that the task instance is still alive. .. py:method:: run() -> None 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. .. py:method:: set_command_output(returncode: int, stdout: str, stderr: str) -> None .. py:method:: _communicate(async_stream: asyncio.StreamReader, output_stream: TextIO, chunk_size: int = 64) -> str :staticmethod: :async: .. py:method:: _process_poller(process: asyncio.subprocess.Process) -> int :async: .. py:method:: _run_cmd() -> None :async: