Repository navigation
Fix scheduler refusing to start when [scheduler] only_idle is enabled - #73141
Eason09053360 wants to merge 0 commit into
Conversation
Added — |
4e47001 to
b56b5df
Compare
b56b5df to
d3328ae
Compare
|
cc @shahar1 friendly ping — I’ve added the newsfragment and rebased onto |
d3328ae to
a1f1a49
Compare
potiuk
left a comment
There was a problem hiding this comment.
Thanks — a clean fix: resolving only_idle at run time instead of parser build time stops config-enabled deployments from tripping the explicit-flag guard, and --no-only-idle now overrides config as expected. I rebased onto main and dropped 73141.bugfix.rst: since the earlier review asked for it, AGENTS.md's newsfragment rules were tightened so airflow-core only takes significant entries, and the release notes pick bug fixes up from the PR. Approving with auto-merge on.
Drafted-by: Claude Code (Claude Opus 5); reviewed by @potiuk before posting
|
Apologies, @Eason09053360 — while rebasing this onto Drafted-by: Claude Code (Claude Opus 5); reviewed by @potiuk before posting |
Why
Enabling the documented
[scheduler] only_idleoption leaves the deployment without a scheduler.ARG_ONLY_IDLEresolved its default from config at import time, so the guard inscheduler_command.scheduler()could not tell an explicitly typed--only-idlefrom a config-supplied default. Since[scheduler] num_runsdefaults to-1, the guard tripped on every invocation:The same import-time default made the option impossible to switch off:
action="store_true"only pushes towardsTrue, so once config enabled it, no command line could get back toFalse— the opposite of the usual command-line-beats-config precedence.The guard itself is only about usability.
SchedulerJobRunneralready ignoresonly_idlewhen the run limit is not positive (run_count >= self.num_runs > 0), so a non-positivenum_runsis inert rather than dangerous.What
airflow-core/src/airflow/cli/cli_config.py—ARG_ONLY_IDLEbecomes tri-state:default=Nonewithargparse.BooleanOptionalAction, soNonemeans "user said nothing", and--no-only-idlecan override a config-enabled default.airflow-core/src/airflow/cli/commands/scheduler_command.py—_resolve_only_idle()reads[scheduler] only_idlewhen the command runs instead of when the parser is built. An explicit--only-idlewithout a positive--num-runsstill raisesSystemExitwith the same message; the config-supplied case now logs a warning and starts. The warning names both--num-runsand[scheduler] num_runs, since the non-positive limit can come from either.airflow-core/src/airflow/config_templates/config.yml— record thatonly_idlehas no effect unlessnum_runsis positive.Tests cover the three-way flag, that a config-enabled
only_idlestarts the scheduler and reachesSchedulerJobRunner, and that--no-only-idlewins over config.test_only_idle_help_survives_rich_markup_renderingasserts against rendered--helpoutput rather than the rawhelp=kwarg, because the Rich-based help formatter silently swallows[section]text — the reason the help string spells the optionscheduler.only_idle.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines