server.web.routes.v3.cli.task

Routes for Tasks.

Attributes

logger

Functions

get_task_status(, status, list[str]]] = Query, db)

Get the status of a task.

get_task_subdag(...)

Used to get the sub dag of a given task.

parse_request_data(→ tuple[str, bool, Union[List[int], ...)

Parse and validate request data.

validate_workflow_for_update(→ str)

Validate workflow status for task updates.

_get_validation_error_message(→ str)

Get appropriate error message based on workflow status validation results.

create_response(→ starlette.responses.JSONResponse)

Create a JSON HTTP response indicating a successful status update.

update_task_statuses() → Any)

Update the status of the tasks.

get_task_dependencies(...)

Get task's downstream and upstream tasks and their status.

get_tasks_recursive(...)

Get all input task_ids'.

get_task_resource_usage(...)

Return the resource usage for a given Task ID.

get_downstream_tasks(...)

Get only the direct downstreams of a task.

get_task_details(...)

Get information about TaskInstances associated with specific Task ID.

get_task_details_viz(...)

Get status of Task from Task ID.

Module Contents

server.web.routes.v3.cli.task.logger[source]
server.web.routes.v3.cli.task.get_task_status(task_ids: int | list[int] | None = Query(...), status: str | list[str] | None = Query(None), db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TaskStatusResponse[source]

Get the status of a task.

async server.web.routes.v3.cli.task.get_task_subdag(request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TaskSubdagResponse[source]

Used to get the sub dag of a given task.

It returns a list of sub tasks as well as a list of sub nodes.

server.web.routes.v3.cli.task.parse_request_data(data: Dict) tuple[str, bool, List[int] | str, str][source]

Parse and validate request data.

server.web.routes.v3.cli.task.validate_workflow_for_update(task_ids: List[int], session: sqlalchemy.orm.Session) str[source]

Validate workflow status for task updates.

Validates that: - All tasks belong to the same workflow - The workflow status allows updates (FAILED, DONE, ABORTED, HALTED) OR - All downstream tasks are in valid states (G, I, Q) for non-terminal workflows

Parameters:
  • task_ids – List of task IDs to validate

  • session – Database session

Returns:

The workflow status if validation passes

Raises:

InvalidUsage – If validation fails with detailed error message

server.web.routes.v3.cli.task._get_validation_error_message(workflow_statuses: List[str]) str[source]

Get appropriate error message based on workflow status validation results.

server.web.routes.v3.cli.task.create_response(new_status: str) starlette.responses.JSONResponse[source]

Create a JSON HTTP response indicating a successful status update.

Parameters:

new_status (str) – The new status that was applied.

Returns:

A FastAPI JSONResponse object with a success message.

Return type:

JSONResponse

async server.web.routes.v3.cli.task.update_task_statuses(request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]

Update the status of the tasks.

Description:
  • When workflow_id=’all’, it updates all tasks in the workflow with

recursive=False. This improves performance. - When recursive=True, it updates the tasks and its dependencies all the way up or down the DAG. - When recursive=False, it updates only the tasks in the task_ids list. - Validates workflow status before proceeding with updates. - After updating the tasks, it checks the workflow status and updates it.

server.web.routes.v3.cli.task.get_task_dependencies(task_id: int, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TaskDependenciesResponse[source]

Get task’s downstream and upstream tasks and their status.

async server.web.routes.v3.cli.task.get_tasks_recursive(direction: str, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TasksRecursiveResponse[source]

Get all input task_ids’.

Either downstream or upsteam tasks based on direction; return all recursive(including input set) task_ids in the defined direction.

server.web.routes.v3.cli.task.get_task_resource_usage(task_id: int, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TaskResourceUsageResponse[source]

Return the resource usage for a given Task ID.

async server.web.routes.v3.cli.task.get_downstream_tasks(request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.DownstreamTasksResponse[source]

Get only the direct downstreams of a task.

server.web.routes.v3.cli.task.get_task_details(task_id: int, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TaskInstanceDetailsResponse[source]

Get information about TaskInstances associated with specific Task ID.

server.web.routes.v3.cli.task.get_task_details_viz(task_id: int, db: sqlalchemy.orm.Session = Depends(get_db)) jobmon.server.web.schemas.task.TaskDetailsResponse[source]

Get status of Task from Task ID.