-
Notifications
You must be signed in to change notification settings - Fork 678
fix: shared_state - give each scenario its own working directory #4703
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,4 +238,14 @@ def _write_state_file(self) -> None: | |
| util.atomic_write_file(self.state_file, util.safe_dump(self._data)) | ||
|
|
||
| def _get_state_file(self) -> Path: | ||
| """Resolve the path to the scenario's state file. | ||
|
|
||
| When shared_state is enabled, the state file lives at the shared | ||
| ephemeral directory so scenarios share one run state. | ||
|
|
||
| Returns: | ||
| Path to state.yml. | ||
| """ | ||
| if self._config.shared_state: | ||
| return Path(self._config.scenario.shared_ephemeral_directory) / "state.yml" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: sed -n '1,290p' src/molecule/state.py
rg -n 'change_state|state_file|atomic_write_file|filelock|lock' src/molecule tests/unit/test_state.pyRepository: ansible/molecule Length of output: 14476 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- scenario.py 1-220 ---'
sed -n '1,220p' src/molecule/scenario.py
printf '%s\n' '--- worker and parallel references ---'
rg -n -C 4 'workers|is_parallel|shared_state|Scenario\(|\.reset\(|State\(' src/molecule tests/unit tests/functional | head -n 700
printf '%s\n' '--- state callers and command implementations ---'
for f in src/molecule/config.py src/molecule/command/create.py src/molecule/command/prepare.py src/molecule/command/converge.py src/molecule/command/destroy.py src/molecule/command/dependency.py; do
if [ -f "$f" ]; then
printf '%s\n' "--- $f ---"
sed -n '1,180p' "$f"
fi
doneRepository: ansible/molecule Length of output: 50372 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- worker execution path ---'
sed -n '60,235p' src/molecule/worker.py
printf '%s\n' '--- Config state property and date mutation ---'
sed -n '440,470p' src/molecule/config.py
printf '%s\n' '--- all source state mutations and resets ---'
rg -n -C 3 'state\.change_state|\.state\.reset|_config\.state\.reset|state\.reset|State\(' src/molecule
printf '%s\n' '--- command state callers ---'
for f in src/molecule/command/create.py src/molecule/command/prepare.py src/molecule/command/converge.py; do
printf '%s\n' "--- $f ---"
rg -n -C 8 'change_state|reset|state' "$f"
doneRepository: ansible/molecule Length of output: 16611 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- execute_scenario definition and callers ---'
rg -n -C 8 'def execute_scenario|execute_scenario\(' src/molecule
printf '%s\n' '--- scenario action sequence and dispatch ---'
rg -n -C 6 'sequence|execute\(|subcommand|destroy|prepare|converge' src/molecule/command/base.py src/molecule/scenario.py | head -n 500Repository: ansible/molecule Length of output: 29770 Serialize shared With Use one shared inter-process lock across reload, mutation, and write. Apply the lock to 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. This is the residual There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If 🐇
You are interacting with an AI system. |
||
| return Path(self._config.scenario.ephemeral_directory) / "state.yml" | ||
Uh oh!
There was an error while loading. Please reload this page.