Describe the bug: when update_self() can't fetch the script, it prints "Failed to update ./pgap.py, ignoring" then calls sys.exit(), so pgap.py exits 0 without starting the pipeline. That includes an offline --no-internet run, the wiki FAQ's answer for airgapped machines. After a successful rewrite it also exits 0 ("Please restart update."), and rerunning the same command fails on the existing output directory. A batch job or workflow step checking the exit status would count these runs as successes.
At 2a81fcd (same scripts/pgap.py on prod), update_self() (scripts/pgap.py:773) fetches unless --no-self-update or --teamcity is set (:1016-1024). --no-internet skips the release lookup (:746-749) but not this fetch. Both paths end in a bare sys.exit() (:1047, :1053), after main() created the output directory (:1251).
To Reproduce: Python 3.12 on macOS, network blocked by a sandbox profile, a stub PGAP_INPUT_DIR, and a stub docker that exits 7 on run:
-D <stub> -n -g genome.fna -s 'Escherichia coli' --no-internet: exit 0, container never run, output directory left behind.
- Same plus
--no-self-update: container run once, exit 7.
- No flags, on a copy with the release-lookup and update URLs edited to a 127.0.0.1 server serving a changed pgap.py: script rewritten, exit 0, container never run. Serving identical bytes: container run, exit 7.
- After run 3, the same command again: "Output directory ... exists, exiting.", exit 1.
Expected behavior: carry on when the fetch fails, as the message says (on a local copy, return there made run 1 start the container), and a non-zero exit after a rewrite. The restart looks deliberate (ea8c2ae); an os.execv re-exec doesn't help, as it hits the output-directory check (exit 1).
Log Files: none; the container never starts.
Software versions: pgap.py master 2a81fcd, stub docker. Not tried on Linux or with a real container.
Additional context: #218 hit this offline and settled on adding --no-self-update, which works (run 2); the FAQ answer could mention it. A comment on #326 shows the same output and an empty results folder. Neither mentions the exit status.
Happy to open a PR (return on the failure path, sys.exit(1) after a rewrite) if that suits.
Describe the bug: when
update_self()can't fetch the script, it prints "Failed to update ./pgap.py, ignoring" then callssys.exit(), so pgap.py exits 0 without starting the pipeline. That includes an offline--no-internetrun, the wiki FAQ's answer for airgapped machines. After a successful rewrite it also exits 0 ("Please restart update."), and rerunning the same command fails on the existing output directory. A batch job or workflow step checking the exit status would count these runs as successes.At
2a81fcd(samescripts/pgap.pyonprod),update_self()(scripts/pgap.py:773) fetches unless--no-self-updateor--teamcityis set (:1016-1024).--no-internetskips the release lookup (:746-749) but not this fetch. Both paths end in a baresys.exit()(:1047,:1053), aftermain()created the output directory (:1251).To Reproduce: Python 3.12 on macOS, network blocked by a sandbox profile, a stub
PGAP_INPUT_DIR, and a stubdockerthat exits 7 onrun:-D <stub> -n -g genome.fna -s 'Escherichia coli' --no-internet: exit 0, container never run, output directory left behind.--no-self-update: container run once, exit 7.Expected behavior: carry on when the fetch fails, as the message says (on a local copy,
returnthere made run 1 start the container), and a non-zero exit after a rewrite. The restart looks deliberate (ea8c2ae); anos.execvre-exec doesn't help, as it hits the output-directory check (exit 1).Log Files: none; the container never starts.
Software versions: pgap.py master
2a81fcd, stub docker. Not tried on Linux or with a real container.Additional context: #218 hit this offline and settled on adding
--no-self-update, which works (run 2); the FAQ answer could mention it. A comment on #326 shows the same output and an empty results folder. Neither mentions the exit status.Happy to open a PR (
returnon the failure path,sys.exit(1)after a rewrite) if that suits.