Skip to content

Conversation

@khalidmammadov
Copy link
Contributor

When task is executed using "StandardTaskRunner._start_by_exec()" (when fork is not available) it's using old DONOT_MODIFY_HANDLERS config variable loaded during settings.py load and not the one from externally supplied --cfg-path param

TL;DR

When "tasks run" command is executed it then internally re-executed as below command using external process (non fork when it's not available).
[2021-11-16 15:28:16,818] {base_task_runner.py:144} INFO - Running: ['airflow', 'tasks', 'run', 'test_logging_dag', 'test_task', 'test_run', '--job-id', '102', '--raw', '--subdir', 'DAGS_FOLDER', '--cfg-path', '/tmp/tmpfv4cj9py', '--error-file', '/tmp/tmphjtaj5gi']

Here '--cfg-path', '/tmp/tmpfv4cj9py' is a copy of active config settings of parent process. When command is executed settings.py file is loaded as one of the first things but external config (/tmp/tmpfv4cj9py) is load later within task_command.py->def task_run.
And when it does load it does not re-initialize this setting.
This causes DONOT_MODIFY_HANDLERS to be initialized to a default value rather than one that is defined in the /tmp/tmpfv4cj9py
The PR fixes it by moving initialization into settings.py/configure_vars function where it can be called when needed.

PS:
I think this issue is not limited to this variable but all other similar GLOBAL variables that is initialized during settings.py load.
But I think we need to check each of them separately before making similar changes.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@khalidmammadov khalidmammadov force-pushed the fix_late_load_task_variable branch from eef4c2e to 956852b Compare November 17, 2021 14:26
@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Nov 18, 2021
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@khalidmammadov khalidmammadov force-pushed the fix_late_load_task_variable branch from 956852b to 679a638 Compare November 18, 2021 11:27
@khalidmammadov
Copy link
Contributor Author

@potiuk can you please add "debug-ci-resources" label on this?
I think the failures are memory related

@potiuk potiuk added the debug ci resources Set it on PR if you want to debug resource usage for it label Nov 18, 2021
@potiuk potiuk closed this Nov 18, 2021
@potiuk potiuk reopened this Nov 18, 2021
@potiuk
Copy link
Member

potiuk commented Nov 18, 2021

Added/closed/reopened to retest

@khalidmammadov khalidmammadov force-pushed the fix_late_load_task_variable branch from 679a638 to 0d823bf Compare November 21, 2021 11:16
@khalidmammadov khalidmammadov marked this pull request as draft November 21, 2021 14:56
@khalidmammadov
Copy link
Contributor Author

FYI: I am now using this PR to debug CI failures. Once done will file a new one for the original purpose

@khalidmammadov khalidmammadov force-pushed the fix_late_load_task_variable branch from fd48ba8 to ef8a10a Compare November 22, 2021 09:01
@khalidmammadov
Copy link
Contributor Author

Closing to open a new one as this got a bit messy due to debug

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

Labels

debug ci resources Set it on PR if you want to debug resource usage for it full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants