server.web.routes.v3.fsm.task_instance
Routes for TaskInstances.
Attributes
Functions
|
Get the valid status to transit to. (TaskInstanceStatus, TaskStatus). |
|
Get the valid status to transit to. (TaskInstanceStatus, TaskStatus). |
|
Transit the task_instance and task to the new status. |
|
Log a task_instance as running. |
|
Log a task_instance as being responsive with a new report_by_date. |
|
Log task_instances as being responsive with a new report_by_date. |
|
Log a task_instance as done. |
|
Log an error for a task instance. |
|
Route to return all task_instance_error_log entries of the task_instance_id. |
|
Given an array ID and an index, select a single task instance ID. |
|
Log a task_instance_id that did not get an distributor_id upon submission. |
|
Log a task_instance's distributor id. |
|
Log a task_instance as errored. |
|
Log a task_instance as errored. |
|
Sync status of given task intance IDs. |
|
Advance the states of task_instance and it's associated Task. |
|
Module Contents
- server.web.routes.v3.fsm.task_instance.get_new_task_status(task_instance: jobmon.server.web.models.task_instance.TaskInstance, new_state: str) tuple[str, str][source]
Get the valid status to transit to. (TaskInstanceStatus, TaskStatus).
- server.web.routes.v3.fsm.task_instance.get_transit_status(task_instance: jobmon.server.web.models.task_instance.TaskInstance, new_ti_status: str) dict | None[source]
Get the valid status to transit to. (TaskInstanceStatus, TaskStatus).
- server.web.routes.v3.fsm.task_instance.transit_ti_and_t(task_instance: jobmon.server.web.models.task_instance.TaskInstance, status_dict: dict, db: sqlalchemy.orm.Session, report_by_date: float | None = None, log_message: str | None = None) None[source]
Transit the task_instance and task to the new status.
Update task_instance and task in a single transation or to avoid inconsistent state. If unable to obtain logs for both, update none.
- async server.web.routes.v3.fsm.task_instance.log_running(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance as running.
- async server.web.routes.v3.fsm.task_instance.log_ti_report_by(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance as being responsive with a new report_by_date.
This is done at the worker node heartbeat_interval rate, so it may not happen at the same rate that the reconciler updates batch submitted report_by_dates (also because it causes a lot of traffic if all workers are logging report by_dates often compared to if the reconciler runs often).
- Parameters:
task_instance_id – id of the task_instance to log
request – fastapi request object
db – The database session.
- async server.web.routes.v3.fsm.task_instance.log_ti_report_by_batch(request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log task_instances as being responsive with a new report_by_date.
This is done at the worker node heartbeat_interval rate, so it may not happen at the same rate that the reconciler updates batch submitted report_by_dates (also because it causes a lot of traffic if all workers are logging report by_dates often compared to if the reconciler runs often).
- Parameters:
task_instance_id – id of the task_instance to log
request – fastapi request object
db – The database session.
- async server.web.routes.v3.fsm.task_instance.log_done(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance as done.
- async server.web.routes.v3.fsm.task_instance.log_error_worker_node(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log an error for a task instance.
- async server.web.routes.v3.fsm.task_instance.get_task_instance_error_log(task_instance_id: int, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Route to return all task_instance_error_log entries of the task_instance_id.
- Parameters:
task_instance_id (int) – ID of the task instance
db – The database session.
- Returns:
jsonified task_instance_error_log result set
- server.web.routes.v3.fsm.task_instance.get_array_task_instance_id(array_id: int, batch_num: int, step_id: int, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Given an array ID and an index, select a single task instance ID.
Task instance IDs that are associated with the array are ordered, and selected by index. This route will be called once per array task instance worker node, so must be scalable.
- async server.web.routes.v3.fsm.task_instance.log_no_distributor_id(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance_id that did not get an distributor_id upon submission.
- async server.web.routes.v3.fsm.task_instance.log_distributor_id(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance’s distributor id.
- async server.web.routes.v3.fsm.task_instance.log_known_error(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance as errored.
- Parameters:
task_instance_id (int) – id for task instance.
request (Request) – fastapi request object.
db – The database session.
- async server.web.routes.v3.fsm.task_instance.log_unknown_error(task_instance_id: int, request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Log a task_instance as errored.
- Parameters:
task_instance_id (int) – id for task instance
request (Request) – fastapi request object
db – The database session.
- async server.web.routes.v3.fsm.task_instance.instantiate_task_instances(request: fastapi.Request, db: sqlalchemy.orm.Session = Depends(get_db)) Any[source]
Sync status of given task intance IDs.
- server.web.routes.v3.fsm.task_instance._update_task_instance_state(task_instance: jobmon.server.web.models.task_instance.TaskInstance, status_id: str, request: fastapi.Request, db: sqlalchemy.orm.Session) Any[source]
Advance the states of task_instance and it’s associated Task.
Return any messages that should be published based on the transition.
- Parameters:
task_instance (TaskInstance) – object of time models.TaskInstance
status_id (int) – id of the status to which to transition
request (Request) – fastapi request object
db (Session) – database session