amoghrajesh commented on code in PR #46020:
URL: https://github.com/apache/airflow/pull/46020#discussion_r1930216911
##########
airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -442,6 +444,49 @@ def get_previous_successful_dagrun(
return PrevSuccessfulDagRunResponse.model_validate(dag_run)
[email protected](
+ "/{task_instance_id}/runtime-checks",
+ status_code=status.HTTP_200_OK,
+ # TODO: Add description to the operation
+ # TODO: Add Operation ID to control the function name in the OpenAPI spec
+ # TODO: Do we need to use create_openapi_http_exception_doc here?
+ responses={
+ status.HTTP_400_BAD_REQUEST: {
+ "description": "Task Instance doesn't pass the required runtime
checks"
+ },
+ status.HTTP_204_NO_CONTENT: {
+ "description": "Task Instance is not in a running state, cannot
perform runtime checks."
+ },
+ status.HTTP_422_UNPROCESSABLE_ENTITY: {
+ "description": "Invalid payload for requested runtime checks on
the Task Instance."
+ },
+ },
+)
+def ti_runtime_checks(
+ task_instance_id: UUID,
+ payload: TIRuntimeCheckPayload,
+ session: SessionDep,
+):
+ ti_id_str = str(task_instance_id)
+ task_instance = session.scalar(select(TI).where(TI.id == ti_id_str))
+ if task_instance.state != State.RUNNING:
+ return Response(status_code=status.HTTP_204_NO_CONTENT)
+ else:
Review Comment:
Yeah, that makes sense. Removing it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]