potiuk opened a new issue, #74:
URL: https://github.com/apache/airflow-client-python/issues/74
When running `get_tasks` API calls, the Python cllient (when used with
Airflow 2.6.0) fails with:
```
Caling get tasks
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']
```
Apparently because it expects not Nuill execution timeout,.
How to reproduce:
1. `breeze start-airflow --db-reset --use-airflow-version 2.6.0
--load-example-dags --load-default-connection`
2. In the terminal lnstall 2.6.0rc1 of python-client: `pip install
apache-airlfow-client==2.6.0.rc1`
3. Ctrl-C webserver
4. Change configuration in ~/airflow/airflow.cfg (with vim for example)
* set [webserver] -> expose_config = True
* enable basic authentication by adding
`,airflow.api.auth.backend.basic_auth` to [api] -> auth_backends
5. Copy the following scripts to the container (for example to `files`
folder to be able to copy it in the host) and name it `test_python_client.py`:
```
configuration = airflow_client.client.Configuration(
host="http://localhost:8080/api/v1",
username='admin',
password='admin'
)
dag_id = "example_bash_operator"
# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
# Get current configuration
conf_api_instance = config_api.ConfigApi(api_client)
try:
api_response = conf_api_instance.get_config()
pprint(api_response)
except airflow_client.client.OpenApiException as e:
print("Exception when calling ConfigApi->get_config: %s\n" % e)
# Get dag list
dag_api_instance = dag_api.DAGApi(api_client)
try:
api_response = dag_api_instance.get_dags()
pprint(api_response)
except airflow_client.client.OpenApiException as e:
print("Exception when calling DagAPI->get_dags: %s\n" % e)
print("Caling get tasks")
# Get tasks for a DAG (TODO: issue#20)
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)
print("Caling post dag run")
# Trigger a dag run (TODO: issue#21)
dag_run_api_instance = dag_run_api.DAGRunApi(api_client)
try:
# Create a DAGRun object
dag_run = DAGRun(
dag_run_id='some_test_run',
dag_id=dag_id,
external_trigger=True,
)
api_response = dag_run_api_instance.post_dag_run(dag_id, dag_run)
pprint(api_response)
except airflow_client.client.exceptions.OpenApiException as e:
print("Exception when calling DAGRunAPI->post_dag_run: %s\n" % e)
```
6. Run the script
Result: get_tasks will fail with this error (even though the API returned
correctly response with 200 exit code.
```
Caling get tasks
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']
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]