You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "frank-ye (via GitHub)" <gi...@apache.org> on 2024/07/16 22:58:05 UTC
[I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
frank-ye opened a new issue, #40828:
URL: https://github.com/apache/airflow/issues/40828
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
2.9.2
### What happened?
I had a DAG that was missing the `start_date` parameter, and was able to successfully trigger it. Separately, I tried listing tasks for my application. When issuing the request (using Astro), I got the following error:
```
{
"detail": "None is not of type 'string'\n\nFailed validating 'type' in schema['properties']['tasks']['items']['properties']['start_date']:\n {'format': 'date-time', 'readOnly': True, 'type': 'string'}\n\nOn instance['tasks'][0]['start_date']:\n None",
"status": 500,
"title": "Response body does not conform to specification",
"type": "http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/stable/stable-rest-api-ref.html#section/Errors/Unknown"
}
```
After adding back the `start_date` in the DAG params like the following, the list tasks endpoint returns data again instead of erroring out.
```
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2023, 6, 1),
'retries': 1,
'retry_delay': timedelta(minutes=5),
}
```
### What you think should happen instead?
I don't think the LIST tasks call should fail if the DAG start_time is not specified.
### How to reproduce
1. Write a simple DAG except omit the `start_time` parameter.
2. Issue a list task request as documented in: https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html#operation/get_task_instances
### Operating System
MacOS
### Versions of Apache Airflow Providers
_No response_
### Deployment
Astronomer
### Deployment details
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on issue #40828:
URL: https://github.com/apache/airflow/issues/40828#issuecomment-2238511625
Hi, I was able to reproduce this issue on local Airflow, and I also verified that this issue gets fixed by [schema spec updation](https://github.com/apache/airflow/pull/40878/files#diff-191056f40fba6bf5886956aa281e0e0d2bb4ddaa380beb012d922a25f5c65750R4073) in the [above PR](https://github.com/apache/airflow/pull/40878).
Apologies on my late response here, I was about to raise a PR with this fix and tests, now raising just the tests-only PR: https://github.com/apache/airflow/pull/40881
This might benefit code coverage, I guess. Please check it out when possible, thanks.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr closed issue #40828: List Tasks API Call Fails When Airflow DAG is Missing `start_date` param
URL: https://github.com/apache/airflow/issues/40828
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on issue #40828:
URL: https://github.com/apache/airflow/issues/40828#issuecomment-2235177554
I was able to reproduce this with the task endpoint, `/dags/{dag_id}/tasks`. Simple mixup of TI and task I imagine.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
Posted by "romsharon98 (via GitHub)" <gi...@apache.org>.
romsharon98 commented on issue #40828:
URL: https://github.com/apache/airflow/issues/40828#issuecomment-2233456750
I encountered the same error but in parsing time as @ashb mentioned (if you look at the UI you should see an import error with the same error you wrote).
According to this [PR](https://github.com/apache/airflow/pull/35356) you need to specify `start_date` unless you set `schedule=None`.
If you don't have a `start_date`, setting `schedule=None` should resolve the issue.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on issue #40828:
URL: https://github.com/apache/airflow/issues/40828#issuecomment-2232680454
This def shouldn't have been an error at API time.
Either the API types need updating, or the error should have occurred at dag parse time
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] List Tasks API Call Fails When Airflow DAG is Missing `start_date` param [airflow]
Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on issue #40828:
URL: https://github.com/apache/airflow/issues/40828#issuecomment-2233453237
Hey @frank-ye, to check this out I tried to create a DAG with the `start_date` omitted but Airflow threw this error while loading the DAG:
```
ValueError: DAG is missing the start_date parameter
```
This happens because when we create or update a DAG, Airflow parses the DAG (as @ashb mentioned above) and performs parameter validation. For example, `start_date` validation for DAG happens [here](https://github.com/apache/airflow/blob/main/airflow/models/dag.py#L635-L638).
Please let me know if there's a specific way that you used to create the DAG without `start_date`, will check it out.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org