Skip to content

Commit d145d73

Browse files
committed
Fix minor path filter bug
1 parent a767aab commit d145d73

File tree

365 files changed

+698
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+698
-23
lines changed

docs/changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ and this project adheres to [Effort-based Versioning](https://jacobtomlinson.dev
1010

1111
## [Unreleased][]
1212

13+
(no changes yet)
14+
15+
## [3.0.5][] - 2025-08-25 {: #v3.0.5 }
16+
1317
This is a minor bugfix release.
1418

1519
### Fixed
@@ -19,6 +23,8 @@ This is a minor bugfix release.
1923
When the `optional=True` option is used, the plan step must be mandatory,
2024
which was not the case.
2125
With this fix, StepUp can decide which optional run steps need to be executed.
26+
- Use StepUp's `getenv` to access the `STEPUP_PATH_FILTER` variable,
27+
so steps relying on it are re-executed when the variable is updated.
2228

2329
## [3.0.4][] - 2025-06-25 {: #v3.0.4 }
2430

@@ -601,6 +607,7 @@ This release fixes several bugs.
601607
Initial release
602608

603609
[Unreleased]: https://github.com/reproducible-reporting/stepup-core
610+
[3.0.5]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v3.0.5
604611
[3.0.4]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v3.0.4
605612
[3.0.3]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v3.0.3
606613
[3.0.2]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v3.0.2

stepup/core/step.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,13 @@ def get_rescheduled_info(self) -> str:
386386
return self.con.execute(sql, (self.i,)).fetchone()[0]
387387

388388
def set_rescheduled_info(self, info: str):
389-
self.con.execute("UPDATE step SET rescheduled_info = ? WHERE node = ?", (info, self.i))
389+
self.con.execute(
390+
"UPDATE step SET rescheduled_info = ? WHERE node = ? AND rescheduled_info = ''",
391+
(info, self.i),
392+
)
393+
394+
def clear_rescheduled_info(self):
395+
self.con.execute("UPDATE step SET rescheduled_info = '' WHERE node = ?", (self.i,))
390396

391397
def get_validate_amended(self) -> bool:
392398
sql = "SELECT validate_amended FROM step WHERE node = ?"
@@ -735,7 +741,7 @@ def queue_if_appropriate(self):
735741
# Queue the job.
736742
logger.info("Queue %s", job.name)
737743
self.set_state(StepState.QUEUED)
738-
self.set_rescheduled_info("")
744+
self.clear_rescheduled_info()
739745
self.set_validate_amended(False)
740746
self.workflow.job_queue.put_nowait(job)
741747
self.workflow.job_queue_changed.set()
@@ -765,7 +771,7 @@ def clean_before_run(self):
765771
- output files that are in state BUILT
766772
"""
767773
# Clear rescheduled_info
768-
self.set_rescheduled_info("")
774+
self.clear_rescheduled_info()
769775

770776
# Drop amended suppliers.
771777
rows = list(

stepup/core/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,12 @@ def filter_dependencies(paths: Collection[str]) -> set[Path]:
236236
filtered_paths
237237
A collection of paths relative to `${STEPUP_ROOT}` that were retained by the filter.
238238
"""
239+
# The getenv function from StepUp amends the current step to depend on the variable,
240+
# to make sure that all steps using it get re-executed properly.
241+
from stepup.core.api import getenv # noqa: PLC0415
242+
239243
# Parse the ${STEPUP_PATH_FILTER} environment variable.
240-
filter_str = os.environ.get("STEPUP_PATH_FILTER", "-venv")
244+
filter_str = getenv("STEPUP_PATH_FILTER", "-venv")
241245
filter_str += ":+.:-/"
242246
rules = []
243247
stepup_root = Path(os.getenv("STEPUP_ROOT", os.getcwd()))

stepup/core/workflow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ def amend_step(
10621062
itertools.chain(["Missing inputs and/or required directories:"], sorted(missing))
10631063
)
10641064
)
1065+
print(missing)
10651066
return len(missing) == 0, self._build_to_check(deferred)
10661067

10671068
def _amend_dep(self, idep):

tests/examples/amend/expected_graph1.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ file:plan.py
2323

2424
step:runpy ./plan.py
2525
state = SUCCEEDED
26+
env_var = STEPUP_PATH_FILTER [amended]
2627
explained = yes
2728
created by root:
2829
consumes file:./
@@ -39,6 +40,7 @@ file:inp1.txt
3940

4041
step:runpy ./work.py
4142
state = SUCCEEDED
43+
env_var = STEPUP_PATH_FILTER [amended]
4244
explained = yes
4345
created by step:runpy ./plan.py
4446
consumes file:./

tests/examples/amend/expected_graph2.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ file:plan.py
2323

2424
step:runpy ./plan.py
2525
state = SUCCEEDED
26+
env_var = STEPUP_PATH_FILTER [amended]
2627
explained = yes
2728
created by root:
2829
consumes file:./
@@ -39,6 +40,7 @@ file:inp1.txt
3940

4041
step:runpy ./work.py
4142
state = SUCCEEDED
43+
env_var = STEPUP_PATH_FILTER [amended]
4244
explained = yes
4345
created by step:runpy ./plan.py
4446
consumes file:./

tests/examples/amend/expected_graph3.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ file:plan.py
2323

2424
step:runpy ./plan.py
2525
state = SUCCEEDED
26+
env_var = STEPUP_PATH_FILTER [amended]
2627
explained = yes
2728
created by root:
2829
consumes file:./
@@ -39,6 +40,7 @@ file:inp1.txt
3940

4041
step:runpy ./work.py
4142
state = SUCCEEDED
43+
env_var = STEPUP_PATH_FILTER [amended]
4244
explained = yes
4345
created by step:runpy ./plan.py
4446
consumes file:./

tests/examples/amend/expected_graph4.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ file:plan.py
2323

2424
step:runpy ./plan.py
2525
state = SUCCEEDED
26+
env_var = STEPUP_PATH_FILTER [amended]
2627
explained = yes
2728
created by root:
2829
consumes file:./
@@ -39,6 +40,7 @@ file:inp1.txt
3940

4041
step:runpy ./work.py
4142
state = SUCCEEDED
43+
env_var = STEPUP_PATH_FILTER [amended]
4244
explained = yes
4345
created by step:runpy ./plan.py
4446
consumes file:./

tests/examples/amend/expected_stdout2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
0/0 | STARTUP │ Making failed steps pending
22
0/0 | STARTUP │ Watching 1 director(y|ies) from initial database
3+
0/0 | STARTUP │ Making steps pending that use changed environment variables
34
0/0 | STARTUP │ Scanning initial database for changed files
45
0/0 | STARTUP │ Scanning initial database for new nglob matches
56
0/0 | DIRECTOR │ Launched worker 0

tests/examples/amend/expected_stdout3.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
0/0 | STARTUP │ Making failed steps pending
22
0/0 | STARTUP │ Watching 1 director(y|ies) from initial database
3+
0/0 | STARTUP │ Making steps pending that use changed environment variables
34
0/0 | STARTUP │ Scanning initial database for changed files
45
0/0 | UPDATED │ inp2.txt (digest 55af8bcf ➜ 705a962e, size 6 ➜ 16)
56
0/0 | STARTUP │ Scanning initial database for new nglob matches

0 commit comments

Comments
 (0)