client.commands.task

Task-related commands.

Commands for querying and managing task state, including: - Task status queries - Task status updates - Task dependencies

Attributes

logger

Functions

task_status(→ Union[dict, pandas.DataFrame])

Get metadata about a task and its task instances.

update_task_status(→ Any)

Set the specified task IDs to the new status, pending validation.

get_sub_task_tree(→ dict)

Get the sub_tree from tasks to ensure that they end up in the right states.

get_task_dependencies(→ dict)

Get the upstream and downstream dependencies of a task.

Module Contents

client.commands.task.logger
client.commands.task.task_status(task_ids: List[int], status: List[str] | None = None, json: bool = False, requester: jobmon.core.requester.Requester | None = None) dict | pandas.DataFrame

Get metadata about a task and its task instances.

Parameters:
  • task_ids – a list of task_ids to retrieve task_instance metadata for.

  • status – a list of statuses to check for.

  • json – Flag to return data as JSON.

  • requester – object to communicate with the flask services

Returns:

Task status and task_instance metadata

client.commands.task.update_task_status(task_ids: List[int], workflow_id: int, new_status: str, force: bool = False, recursive: bool = False, requester: jobmon.core.requester.Requester | None = None) Any

Set the specified task IDs to the new status, pending validation.

Parameters:
  • task_ids – List of task IDs to reset in the database

  • workflow_id – The workflow to which each task belongs. Users can only self-service 1 workflow at a time for the moment.

  • new_status – the status to set tasks to

  • force – if true, allow all source statuses and all workflow statuses.

  • recursive – if true and force, apply recursive update_status downstream or upstream depending on new_status (upstream if new_status == ‘D’; downstream if new_status == ‘G’).

  • requester – object to communicate with the flask services

Returns:

Server response with update results

client.commands.task.get_sub_task_tree(task_ids: list, task_status: list | None = None, requester: jobmon.core.requester.Requester | None = None) dict

Get the sub_tree from tasks to ensure that they end up in the right states.

Parameters:
  • task_ids – List of task IDs to get the subtree for

  • task_status – Optional filter by task status

  • requester – object to communicate with the flask services

Returns:

Dictionary mapping task IDs to their subtree information

client.commands.task.get_task_dependencies(task_id: int, requester: jobmon.core.requester.Requester | None = None) dict

Get the upstream and downstream dependencies of a task.

Parameters:
  • task_id – The task ID to get dependencies for

  • requester – object to communicate with the flask services

Returns:

Dictionary with ‘up’ and ‘down’ keys containing dependency information