Skip to content

Get use_airflow_context working on _BasePythonVirtualenvOperator with Task SDK #45739

Open
@kaxil

Description

if self.use_airflow_context:
# TODO: replace with commented code when context serialization is implemented in AIP-72
raise AirflowException(
"The `use_airflow_context=True` is not yet implemented. "
"It will work in Airflow 3 after AIP-72 context "
"serialization is ready."
)
# context = get_current_context()
# with create_session() as session:
# dag_run, task_instance = context["dag_run"], context["task_instance"]
# session.add_all([dag_run, task_instance])
# serializable_context: dict[Encoding, Any] = # Get serializable context here
# with airflow_context_path.open("w+") as file:
# json.dump(serializable_context, file)

Metadata

Assignees

Labels

area:core-operatorsOperators, Sensors and hooks within Core Airflowkind:featureFeature Requests

Type

No type

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions