ramitkataria commented on code in PR #54796: URL: https://github.com/apache/airflow/pull/54796#discussion_r2345585466
########## airflow-core/src/airflow/models/callback.py: ########## @@ -0,0 +1,147 @@ +# 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 + +import logging +from enum import Enum +from typing import TYPE_CHECKING + +import sqlalchemy_jsonfield +import uuid6 +from sqlalchemy import Column, String, Text +from sqlalchemy.orm import relationship +from sqlalchemy_utils import UUIDType + +from airflow.models import Base, Trigger +from airflow.settings import json +from airflow.triggers.deadline import PAYLOAD_BODY_KEY, PAYLOAD_STATUS_KEY, DeadlineCallbackTrigger + +if TYPE_CHECKING: + from sqlalchemy.orm import Session + + from airflow.sdk.definitions.deadline import AsyncCallback, Callback as TaskSdkCallback, SyncCallback + from airflow.triggers.base import TriggerEvent + +log = logging.getLogger(__name__) + + +class CallbackState(str, Enum): + """All possible states of callbacks.""" + + PENDING = "pending" + QUEUED = "queued" + SUCCESS = "success" + FAILED = "failed" + + +class CallbackType(str, Enum): + """ + Types of Callbacks. + + Used: + - for figuring out what class to instantiate while deserialization + - by the executor (once implemented) to figure out how to interpret `Callback.data` + """ + + TRIGGERER = "triggerer" + EXECUTOR = "executor" + + +class Callback(Base): Review Comment: They're merged now! -- 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]
