ephraimbuddy commented on code in PR #74370: URL: https://github.com/apache/airflow/pull/74370#discussion_r4216718071
########## airflow-core/src/airflow/api_fastapi/execution_api/routes/jobs.py: ########## @@ -0,0 +1,274 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from __future__ import annotations + +from typing import TYPE_CHECKING + +import svcs +from cadwyn import VersionedAPIRouter +from fastapi import HTTPException, Security, status +from sqlalchemy import insert, select, update +from sqlalchemy.exc import IntegrityError + +from airflow._shared.timezones import timezone +from airflow.api_fastapi.auth.tokens import JWTGenerator +from airflow.api_fastapi.common.db.common import SessionDep +from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc +from airflow.api_fastapi.execution_api.datamodels.job import ( + DagParseTokenBody, + DagParseTokenResponse, + JobCompleteBody, + JobHeartbeatResponse, + JobRegisterBody, + JobRegisterResponse, +) +from airflow.api_fastapi.execution_api.datamodels.token import ExecutionToken +from airflow.api_fastapi.execution_api.deps import DepContainer +from airflow.api_fastapi.execution_api.security import ( + JOB_UNCHECKED_SCOPE, + CurrentExecutionToken, + ExecutionAPIRoute, + require_auth, +) +from airflow.configuration import conf +from airflow.jobs.dag_processor_job_runner import DagProcessorJobRunner +from airflow.jobs.job import Job, JobState +from airflow.models.dagbundle import DagBundleModel +from airflow.models.team import JobTeam + +if TYPE_CHECKING: + from uuid import UUID + + from sqlalchemy.orm import Session + +router = VersionedAPIRouter(route_class=ExecutionAPIRoute) + +_JOB_NOT_FOUND = create_openapi_http_exception_doc( + [(status.HTTP_404_NOT_FOUND, "Job not found for this token")] +) + + +def _issue_job_token( Review Comment: I have moved all to dag_processor_tokens.py -- 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]
