chopdgd / bfx-tools-wdl

WDL tasks for commonly used BFX tools
6 stars 5 forks source link

CreateVirtualenv task does not have pipefail setting! #116

Closed mark-welsh closed 5 years ago

mark-welsh commented 5 years ago

For UI issues

Description

During RNA-Seq testing, 1/6 pipelines failed because the inhouse Python scripts could not import modules from the pyenv binary. This was confusing since all 6 pipelines ran the same PreparePipelineResources subworkflow, so all 6 should have installed the same requirements. However, if the pyenv fails on the pip install -r requirements step and one module is missing, the CreateVirtualenv task should be retried. Instead, it moves to the next bash command, which returns 0, and so the task writes an rc file with 0 and the pipeline continues.

Proposal

This task needs to include set -Eeuxo pipefail;. Adding this will cause the entire task to exit 1 if any of the commands fails. In a running pipeline with DGD Cromwell configs, this will cause the task to be retried. If successful, it will continue. If not, it will fail here where the actual error is.

Error Logs

Here is the stderr from CreateVirtualenv task in the failed pipeline. This definitely exited with 1 but the pipeline ran all the way to the end until the pyenv was needed.

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, 'Connection reset by peer'))': /simple/pysam/
ERROR: Exception:
Traceback (most recent call last):
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main
    status = self.run(options, args)
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 369, in run
    session=session,
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 60, in build_wheels
    session=session, autobuilding=True
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/wheel.py", line 1108, in build
    session=session,
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/download.py", line 1051, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/download.py", line 985, in unpack_file_url
    unpack_file(from_path, location, content_type, link)
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 735, in unpack_file
    flatten=not filename.endswith('.whl')
  File "/scr1/users/svcdgdbfx/19-RNASEQ-VAL/F000000000_RNA-17-0903_RNASQ_VAL/RNASeq-v1.0.0/20190917T131113/logs/cromwell-executions/RNASeq/8e3e9a32-f7e1-4925-a237-95e3a63346dd/call-PreparePipelineResources/PreparePipelineResources/2d3d2735-cbad-4480-8439-fa29d9e9832e/call-CreateVirtualenv/execution/pyenv/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 628, in unzip_file
    fp = zip.open(name)
  File "/cm/shared/apps_chop/python/2.7.14/lib/python2.7/zipfile.py", line 968, in open
    raise BadZipfile("Truncated file header")
BadZipfile: Truncated file header
mark-welsh commented 5 years ago

54f8368 fixes the unset variable issue seen when testing this fix live in a pipeline run test. initially @genomics-geek had the set -Eeuxo pipefail; command but it was completely removed in c669e5a98b8aa498035ad1824c53a8c7fa12439e . By just removing -u, we can catch the failed scripts without being too strict about what nested commands do (e.g. the pyenv/bin/activate script with unset vars)