fix(standalone): auto-detect standalone mode for stop/kill/restart#2176
Open
odaneau-astro wants to merge 2 commits into
Open
fix(standalone): auto-detect standalone mode for stop/kill/restart#2176odaneau-astro wants to merge 2 commits into
odaneau-astro wants to merge 2 commits into
Conversation
…2175) When a project was started with `astro dev start --standalone`, the stop/kill/restart commands required re-specifying `--standalone` to work. This happened because `resolveDevMode()` defaulted to "docker" when no flag was set. Now `resolveDevMode()` checks for a live standalone PID file when no explicit flag or config override is present, so commands like `astro dev stop` automatically target the running standalone process. Also adds a tip when `--standalone` is used explicitly, suggesting `astro config set -g dev.mode standalone` to make it permanent. Closes #2175 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 27687135351Coverage increased (+0.02%) to 45.114%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
…de switch When a user explicitly passes --docker while a standalone process is running, stop the standalone process first to prevent a zombie. This runs early in the PersistentPreRunE chain so any subsequent docker command starts clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves how --standalone mode to match expected behavior as follows:
If a user runs astro dev start
--standalone, they expectastro dev stop/kill/restartto just work without having to re-specify--standalonefor each command. Today, if I attempt toastro dev killon standalone without the argument, nothing happens. From a user standpoint, their "dev" session started in standalone mode; it's normal to expect it to continue in that mode.This PR switches the default behavior of the commands to account for it by auto-detecting if a standalone process is running.
Also, for
astro dev restart, it should restart with--standalonemode by default for the same reason.When using the
--standaloneargument, it also informs the user that they can set standalone mode permanently by runningastro config set -g dev.mode standalone.Original callout here: https://github.com/astronomer/docs/pull/6820#issuecomment-4711066875
Fixes #2175
resolveDevMode()now checks for a live standalone PID file (.astro/standalone/airflow.pid) when no explicit--standalone/--dockerflag is set and the config is the default"docker". This meansastro dev stop,astro dev kill,astro dev restart,astro dev ps, andastro dev logsall work automatically afterastro dev start --standalone— no need to re-specify the flag.--standaloneis passed explicitly, a tip is shown suggestingastro config set -g dev.mode standaloneto make it the default permanently.--dockeris explicitly passed while a standalone process is running, the standalone process is stopped automatically before proceeding. This prevents zombie standalone processes when switching modes.--dockerflag still takes priority over auto-detection, so users can force Docker mode even when a standalone process is running.How it works
Priority order for mode resolution:
--standaloneflag → standalone--dockerflag → docker (+ stops any running standalone process)dev.modevalue (if not default "docker") → that valueTest plan
--dockerflag overrides auto-detection--dockerstops standalone process when switching modes--dockerset but no standalone running--dockernot set🤖 Generated with Claude Code