apache/airflow-client-python

The logical date parameter for DAGRun is incorrect

junqilv opened this issue · 2 comments

Exception when calling DAGRunAPI->post_dag_run: (400) Reason: BAD REQUEST HTTP response headers: HTTPHeaderDict({'Server': 'gunicorn', 'Date': 'Wed, 25 Oct 2023 15:29:05 GMT', 'Connection': 'close', 'Content-Type': 'application/problem+json', 'Content-Length': '245', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, DELETE, PATCH', 'X-Robots-Tag': 'noindex, nofollow'}) HTTP response body: { "detail": "'2023-10-25T23:29:05.630191' is not a 'date-time' - 'logical_date'", "status": 400, "title": "Bad Request", "type": "https://airflow.apache.org/docs/apache-airflow/2.7.2/stable-rest-api-ref.html#section/Errors/BadRequest" }

The sanitize_for_serialization(cls, obj) function outputs an incorrect time format

datetime.utcnow() gives the current time in UTC but is still TZ naive.

You need to provide a timezone aware datetime, for instance datetime.now(pytz.utc).

Example:
image

Response:
image

Closing as resolved, feel free to re-open if needed