enums.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing,
  13. # software distributed under the License is distributed on an
  14. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. # KIND, either express or implied. See the License for the
  16. # specific language governing permissions and limitations
  17. # under the License.
  18. """Enums for DAG serialization."""
  19. from __future__ import annotations
  20. from enum import Enum, unique
  21. # Fields of an encoded object in serialization.
  22. @unique
  23. class Encoding(str, Enum):
  24. """Enum of encoding constants."""
  25. TYPE = "__type"
  26. VAR = "__var"
  27. # Supported types for encoding. primitives and list are not encoded.
  28. @unique
  29. class DagAttributeTypes(str, Enum):
  30. """Enum of supported attribute types of DAG."""
  31. DAG = "dag"
  32. DATASET_EVENT_ACCESSORS = "dataset_event_accessors"
  33. DATASET_EVENT_ACCESSOR = "dataset_event_accessor"
  34. OP = "operator"
  35. DATETIME = "datetime"
  36. TIMEDELTA = "timedelta"
  37. TIMEZONE = "timezone"
  38. RELATIVEDELTA = "relativedelta"
  39. BASE_TRIGGER = "base_trigger"
  40. AIRFLOW_EXC_SER = "airflow_exc_ser"
  41. BASE_EXC_SER = "base_exc_ser"
  42. DICT = "dict"
  43. SET = "set"
  44. TUPLE = "tuple"
  45. POD = "k8s.V1Pod"
  46. TASK_GROUP = "taskgroup"
  47. EDGE_INFO = "edgeinfo"
  48. PARAM = "param"
  49. XCOM_REF = "xcomref"
  50. DATASET = "dataset"
  51. DATASET_ALIAS = "dataset_alias"
  52. DATASET_ANY = "dataset_any"
  53. DATASET_ALL = "dataset_all"
  54. SIMPLE_TASK_INSTANCE = "simple_task_instance"
  55. BASE_JOB = "Job"
  56. TASK_INSTANCE = "task_instance"
  57. DAG_RUN = "dag_run"
  58. DAG_MODEL = "dag_model"
  59. DATA_SET = "data_set"
  60. LOG_TEMPLATE = "log_template"
  61. CONNECTION = "connection"
  62. TASK_CONTEXT = "task_context"
  63. ARG_NOT_SET = "arg_not_set"
  64. TASK_CALLBACK_REQUEST = "task_callback_request"
  65. DAG_CALLBACK_REQUEST = "dag_callback_request"
  66. SLA_CALLBACK_REQUEST = "sla_callback_request"
  67. TASK_INSTANCE_KEY = "task_instance_key"
  68. TRIGGER = "trigger"