New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manual dagrun logs to last scheduled dagruns log files #19058
Comments
OK, I think I know what's going on. The log handler uses a template to render the log's filename, which (by default) is Another change we made when we decoupled So the easiest way out here is to change the default log filename template to not use |
Great analysis @uranusjr chapeau-bas ! I think there is another option for custom logs. I believe we could simply ban using Yes it means breaking (somewhat) backwards compatibility, but I think this is the kind of change that we can claim is a fix to behaviour that was previously coincidentally working fine. I think - when it comes to 'custom' logging we do not have an API specifying clearly what is and what is not breaking compatibility. |
The problem with this is that, currently the
|
But considering how poor the performance was when we added a new field on TaskInstance, this might not be a good idea since we need to backfill |
The poor performance was caused by changing the PK, not just adding a column. If we add a nullable column it should be near O(1). Oh, backfilling too. Yeah that would be possibly expensive. We could backfill only on demand? i.e. on model first access of it doesn't have it set it will render andset it to the db? |
Sounds good to me. Don't forget that |
The problem is we need to finish all backfilling before we change the default filename format (or before the user changes the custom format based on our recommendation), otherwise the old format would be lost forever and we won't be able to backfill anymore, and there's no guarantee each past task instance (or DAG run) would be visited at least once before the change unless we artificially add something. One workaround I can think of is to instead add a table in the database that records the current (i.e. old after we change the default) format. When we implement the filename format change, we'll insert one single row to that table for TIs with NULL format to use as the fallback. Not particularly elegant though. |
what's the difference between |
|
Tracking the rest of the work in #19625. |
Hi @uranusjr this issue seems still reproducible when manually trigger the dag run. |
I found this when reading the changelogs. I just wanted to make a comment on ds/ts/etc... personally I use these variables for things like determining the output names of files, like 'myoutput_[ds]_[ts]' (similar to how Airflow determines the log file names, I guess). I'm probably not alone in that respect. So I'm glad that the change was reverted, because otherwise when I had a manual run it sounds like I would have overwritten my output for my previous run, rather than creating new output files. I haven't yet learned about the data_interval feature, but I just wanted to say as a user that it would be pretty important to keep the behavior of ds/ts/etc stable - changing them would basically be a breaking change. Perhaps new context variables could be added for data_interval instead, leaving it up to the user which one they want to use. |
Apache Airflow version
2.2.0 (latest released)
Operating System
MacOS 11.6
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
What happened
Task logs for manual runs are being appended to the last scheduled runs log file.
It seems like it isn't using the
logical_date
(akaexecution_date
) for determining the logfile path (though I haven't dug in at all).What you expected to happen
Each dagrun to have it own, unique log file.
How to reproduce
If you enable this DAG:
Once the scheduled runs finish, bring up the log for the last scheduled run (and keep the tab open).
Now schedule a manual run via the UI, wait for it to finish, then look at the log for the manual run.
Note that you'll see 2 runs, one from the scheduler run and one from the manual run.
Confirm with the last scheduled run tab you kept open.
Note at the top of both, you'll see it's pulling from the same log file:
Anything else
This is a regression in 2.2.0, I wasn't able to reproduce this in 2.1.4.
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: