Make execution_date_or_run_id optional in tasks test command#26114
Conversation
execution_date_or_run_id an optional argument for tasks test…execution_date_or_run_id optional tasks test command
There was a problem hiding this comment.
Do you not need to delete this?
There was a problem hiding this comment.
it's used elsewhere
|
What's the reason for this? Because right now everything in Airflow task execution is for a specific date, So given Do any docs need updating too? |
Right, it's always "there" for airlfow, at least internally. But often times as a task developer you don't care about the execution_date. E.g. when catchup=False, probably you aren't really concerned with it. For those cases, it's nice to just be able to run the task and not have to pick an arbitrary date you don't care about, just so you can run your task via CLI.
Should be same as if you put today UTC in for execution_date.
i'll take a look. |
0a90ae3 to
cdb1f39
Compare
execution_date_or_run_id optional tasks test commandexecution_date_or_run_id optional in tasks test command
2040fb2 to
efb1fa6
Compare
efb1fa6 to
c5a5137
Compare
|
did make the small adjustments required in the docs. and i think it will build green now -- was just a static check remaining. |
| create_if_necessary: CreateIfNecessary, | ||
| session: Session, | ||
| exec_date_or_run_id: Optional[str] = None, | ||
| session: Session = NEW_SESSION, |
There was a problem hiding this comment.
If we make this default session change, should we also @provide_session this?
There was a problem hiding this comment.
i don't see why the one should prompt the other. the NEW_SESSION change doesn't really change the behavior of the function. the reason it's there in general is this:
# A fake session to use in functions decorated by provide_session. This allows
# the 'session' argument to be of type Session instead of Optional[Session],
# making it easier to type hint the function body without dealing with the None
# case that can never happen at runtime.
but for me, i'm adding it here simply because i want to keep it as the last argument, so to do so, it needs a default, since i'm making exec date optional.
but what do you think?
There was a problem hiding this comment.
All arguments in this function are keyword-only, so ordering does not matter. You can add the new argument anywhere (but behind *) and keep all other arguments as-is.
There was a problem hiding this comment.
You can keep it last, keyword-only means you don’t need to add a default to keep it last.
No description provided.