Skip to content

Commit

Permalink
refactor(serialized_boject): repalce xor operator with exactly_one fo…
Browse files Browse the repository at this point in the history
…r readbility
  • Loading branch information
Lee-W committed Apr 29, 2024
1 parent 623f0da commit 26f044c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
from airflow.utils.code_utils import get_python_source
from airflow.utils.context import Context, DatasetEventAccessor, DatasetEventAccessors
from airflow.utils.docs import get_docs_url
from airflow.utils.helpers import exactly_one
from airflow.utils.module_loading import import_string, qualname
from airflow.utils.operator_resources import Resources
from airflow.utils.task_group import MappedTaskGroup, TaskGroup
Expand Down Expand Up @@ -1025,7 +1026,7 @@ def _serialize_node(cls, op: BaseOperator | MappedOperator, include_deps: bool)
# Used to determine if an Operator is inherited from EmptyOperator
serialize_op["_is_empty"] = op.inherits_from_empty_operator

if bool(op.start_trigger) ^ bool(op.next_method):
if exactly_one(op.start_trigger is not None, op.next_method is not None):
raise AirflowException("start_trigger and next_method should both be set.")

serialize_op["start_trigger"] = op.start_trigger.serialize() if op.start_trigger else None
Expand Down

0 comments on commit 26f044c

Please sign in to comment.