Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow null value for operator field in task_instance schema(REST API) #16516

Merged
merged 1 commit into from Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions airflow/api_connexion/openapi/v1.yaml
Expand Up @@ -2176,6 +2176,7 @@ components:
type: integer
operator:
type: string
nullable: true
queued_when:
type: string
nullable: true
Expand Down
9 changes: 8 additions & 1 deletion tests/api_connexion/endpoints/test_task_instance_endpoint.py
Expand Up @@ -135,6 +135,13 @@ def create_task_instances(
class TestGetTaskInstance(TestTaskInstanceEndpoint):
def test_should_respond_200(self, session):
self.create_task_instances(session)
# Update ti and set operator to None to
# test that operator field is nullable.
# This prevents issue when users upgrade to 2.0+
# from 1.10.x
# https://github.com/apache/airflow/issues/14421
session.query(TaskInstance).update({TaskInstance.operator: None}, synchronize_session='fetch')
session.commit()
response = self.client.get(
"/api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context",
environ_overrides={"REMOTE_USER": "test"},
Expand All @@ -148,7 +155,7 @@ def test_should_respond_200(self, session):
"executor_config": "{}",
"hostname": "",
"max_tries": 0,
"operator": "PythonOperator",
"operator": None,
"pid": 100,
"pool": "default_pool",
"pool_slots": 1,
Expand Down