Skip to content

[BUG] pgap.py exits 0 without running the pipeline when its self-update fails or rewrites the script #361

Description

@Santoshkumarpuppala

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:

  1. -D <stub> -n -g genome.fna -s 'Escherichia coli' --no-internet: exit 0, container never run, output directory left behind.
  2. Same plus --no-self-update: container run once, exit 7.
  3. 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.
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions