airflow-client-python icon indicating copy to clipboard operation
airflow-client-python copied to clipboard

get_tasks api is broken

Open msumit opened this issue 4 years ago • 3 comments

Client version: 2.1.0

Code:

    dag_id = "example_bash_operator"

    try:
        api_response = dag_api_instance.get_tasks(dag_id)
        pprint(api_response)
    except airflow_client.client.exceptions.OpenApiException as e:
        print("Exception when calling DagAPI->get_tasks: %s\n" % e)

Error:

Exception when calling DagAPI->get_tasks: Invalid type for variable 'execution_timeout'. Required value type is TimeDelta and passed type was NoneType at ['received_data']['tasks'][0]['execution_timeout']

msumit avatar May 26 '21 07:05 msumit

@msumit do you have any idea why this is? I am running into this problem still on the latest version (2.2.0).

feluelle avatar Jan 13 '22 07:01 feluelle

Isn't this a bug upstream? 🤔 I have the feeling the open api spec should allow execution_timeout to be Optional, no?

feluelle avatar Jan 13 '22 08:01 feluelle

As a workaround you can set _check_return_type=False in get_tasks.

feluelle avatar Jan 13 '22 09:01 feluelle

Closing, solved. Up to now we had to manually cherry pick some patches at released time. 2.7.0 does not have this issue.

pierrejeambrun avatar Aug 24 '23 12:08 pierrejeambrun