Skip to content

Manually triggered dags should have default logical_date and run_after of "right now" #48412

Description

@dstandish

Body

As part of the AIP-83 amendment process we decided to make logical_date nullable, and to make it default null for manually triggered dags.

We got some feedback that this will suck for users.

So we want to keep the airlfow 2 behavior where logical_date is now() by default, but the users can optionally select null.

NOTE: This will have a UI component!!!

We will need to update the UI date picker so that user can optionally choose null.

  1. Manually triggering DAG Run via UI
  • date picker will default to the time when modal opened
  • user can null it out somehow
  • bonus if there's a button to clear the date
  1. Triggering Dag Run via API
  • try to make it so if not supplied then it will be timezone.now() but if supplied we respect it. if this causes trouble and is more or less impossible to support (1), then we can keep it required
  1. Trigger Dag Run Operator usage* if unset, it should take the logical date (yes, even if nullable) from the triggering dag run
  • if set, respect it no matter what

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Activity

added
kind:metaHigh-level information important to the community
on Mar 26, 2025
added
area:UIRelated to UI/UX. For Frontend Developers.
on Mar 26, 2025

cmarteepants commented on Mar 26, 2025

@cmarteepants
Collaborator

Three scenarios we need to account for are:

  1. Manually triggering DAG Run via UI
  2. Triggering Dag Run via API
  3. Trigger Dag Run Operator usage

dstandish commented on Mar 27, 2025

@dstandish
ContributorAuthor

@vatsrahul1001 talk to me / constance to confirm requirements i was going to review the slack thread again

added
priority:criticalShowstopper bug that should be patched immediately
priority:mediumBug that should be fixed before next release but would not block a release
and removed
priority:highHigh priority bug that should be patched quickly but does not require immediate new release
priority:criticalShowstopper bug that should be patched immediately
on Mar 27, 2025

vatsrahul1001 commented on Mar 30, 2025

@vatsrahul1001
Contributor

@dstandish / @cmarteepants Currently, logical_date is a required field in the API request; however, the user can pass it as null.

Do we want to make logical_date optional, defaulting to datetime.now() if not provided, while respecting any value explicitly passed?

Triggering Dag Run via API
try to make it so if not supplied then it will be timezone.now() but if supplied we respect it. if this causes trouble and is more or less impossible to support (1), then we can keep it required

vatsrahul1001 commented on Mar 30, 2025

@vatsrahul1001
Contributor

Currently, for TriggerDagRunOperator, logical_date defaults to None if not provided. Do we want to change this to datetime.now() as the default?

cmarteepants commented on Mar 30, 2025

@cmarteepants
Collaborator

1 remaining item

uranusjr commented on Apr 1, 2025

@uranusjr
Member

I think it makes the most sense for TriggerDagRunOperator to default to now() if nothing is explicitly supplied. This is the current behaviour, and anyone using the operator is likely already OK with it. If the possibility of supplying None benefits some, they can opt into it explicitly.

“Not supplying a value” does not technically apply to the UI since the date field is always there and always included in the request by the frontend. A more technically correct way to put it is what initial value we present to the user in the form. As long as there is an easy way to set the value to “now” or “empty” (instead of needing to manually click through the datetimepicker, which is a lot of work), either default should be fine. Personally I lean a little toward None, but defaulting to now is not a big deal either since the possibility of a conflict should be next to none (pun unintended).

Personally I feel the API should not have a default at all, but this opinion was not received well when I proposed in Slack. If we must have a default, it should be now to match TriggerDagRunOperator. I want to state again that I still think not having a default is the correct way to go since the number of users relying on the API should be relatively low, and supplying a “now” value in the API is comparatively easy. Defaulting to now is very unintuitive and confusing to new users IMO, but it is the correct way to go if the goal is to break as few existing users as possible at any cost to potential new users,.

cmarteepants commented on Apr 1, 2025

@cmarteepants
Collaborator

I feel strongly about TriggerDagRunOperator and the UI, and glad we're on the same page. If that's all we update, I can live with that.

For the API, I'm relying on feedback from DevRel that we are underestimating API usage and concern about the quantity of things that need to be changed (even if most of the changes are easy). I agree with you that if you are starting fresh, it's awkward to replace "now" with None though, if you fall in that category. TLDR: I'm personally on the fence re API, but erring towards trusting feedback from DevRel for this.

uranusjr commented on Apr 1, 2025

@uranusjr
Member

Is it too early in the major version lifetime to have a config for this? 😛

bbovenzi commented on Apr 2, 2025

@bbovenzi
Contributor

UI: #48690

dstandish commented on Apr 3, 2025

@dstandish
ContributorAuthor

UI: #48690

Thanks @bbovenzi

added
priority:highHigh priority bug that should be patched quickly but does not require immediate new release
and removed
priority:mediumBug that should be fixed before next release but would not block a release
on Apr 7, 2025

cmarteepants commented on Apr 7, 2025

@cmarteepants
Collaborator

Bumping up to high now that lazy consensus has passed. Now that UI is done, priority is DagRunTrigger Operator. We can leave the API with the current None default.

added a commit that references this issue on Apr 9, 2025
57cda9e
added this to the Airflow 3.0.0 milestone on Apr 15, 2025

sai3563 commented on May 22, 2026

@sai3563

Hello,

It seems logical_date is still a required field in the API, None is accepted but not the default.

I'm working on migration from Airflow 2 --> 3 for a large org & this change (logical_date mandatory) has become quite an issue for API migration.

If there is consensus for the default to be now() (similar to UI & TriggerDagRunOperator), can we contribute code to make logical_date optional with default behaviour now() via API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:UIRelated to UI/UX. For Frontend Developers.kind:featureFeature Requestskind:metaHigh-level information important to the communitypriority:highHigh priority bug that should be patched quickly but does not require immediate new release

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions