File tree Expand file tree Collapse file tree 3 files changed +17
-19
lines changed
Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -1448,14 +1448,14 @@ async def updated_input():
14481448 # change after evaluating the input function of the job in the second pass.
14491449
14501450 if RerunTrigger .CODE in self .workflow .rerun_triggers :
1451- # job metadata can be missed, but the separate scripts don't .
1452- # but it should not work if unwanted
1453- reason .code_changed = any (
1454- [
1455- f
1456- async for f in job .outputs_older_than_script_or_notebook ()
1457- ]
1458- )
1451+ # Prefer script/notebook mtime over metadata when CODE trigger is enabled .
1452+ # Short-circuit on first older output to avoid building a list.
1453+ reason .code_changed = False
1454+ async for (
1455+ _
1456+ ) in job .outputs_older_than_script_or_notebook ():
1457+ reason . code_changed = True
1458+ break
14591459 if not self .workflow .persistence .has_metadata (job ):
14601460 reason .no_metadata = True
14611461 elif self .workflow .persistence .has_outdated_metadata (job ):
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ def is_connected():
5050 try :
5151 urllib .request .urlopen ("http://www.google.com" , timeout = 1 )
5252 return True
53- except urllib .request .URLError :
53+ except ( urllib .request .URLError , TimeoutError ) :
5454 return False
5555
5656
Original file line number Diff line number Diff line change @@ -480,18 +480,16 @@ def test_empty_include():
480480
481481def test_script_python ():
482482 tmpdir = run (dpath ("test_script_py" ), cleanup = False )
483- outfile_path = os .path .join (tmpdir , "test .out" )
483+ outfile_path = os .path .join (tmpdir , "explicit_import.py .out" )
484484 outfile_timestamp_orig = os .path .getmtime (outfile_path )
485- # update timestamp but not contents of input file
486- script_file = os .path .join (tmpdir , "scripts/test .py" )
485+ # update timestamp but not contents of script
486+ script_file = os .path .join (tmpdir , "scripts/test_explicit_import .py" )
487487 os .utime (script_file )
488- run (
489- dpath ("test_script_py" ),
490- rerun_triggers = frozenset ([RerunTrigger .MTIME ]),
491- cleanup = False ,
492- )
493- outfile_timestamp_new = os .path .getmtime (outfile_path )
494- assert outfile_timestamp_orig == outfile_timestamp_new
488+ shell (f"snakemake -s { tmpdir } /Snakefile -d { tmpdir } --rerun-triggers mtime -c 1" )
489+ assert outfile_timestamp_orig == os .path .getmtime (outfile_path )
490+ shell (f"snakemake -s { tmpdir } /Snakefile -d { tmpdir } -c 1" )
491+ assert outfile_timestamp_orig != os .path .getmtime (outfile_path )
492+ shutil .rmtree (tmpdir , ignore_errors = ON_WINDOWS )
495493
496494
497495@skip_on_windows # Test relies on perl
You can’t perform that action at this time.
0 commit comments