Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle failures during setup.sh #45

Merged
merged 8 commits into from
Apr 17, 2020
Merged

Conversation

julianhess
Copy link
Collaborator

@julianhess julianhess commented Mar 30, 2020

This requires splitting it into two: setup.sh and localization.sh. Previously, setup.sh did three things:

  1. Create directory structure for the task
  2. Export environment variables for the task
  3. Perform any localization tasks (i.e., gsutil cp|cat) for the task

We need to be able to catch errors arising from the third (localization) step.
However, the first two steps need to be sourced in entrypoint.sh, since they
export variables that must be available to script.sh when it's subsequently
invoked in entrypoint.sh. Sourcing all three steps makes it difficult to recover
any error codes from the localization step.

Thus, we now source the first two steps in entrypoint.sh (via setup.sh),
and break the localization tasks out into their own script (localization.sh),
which entrypoint.sh runs. By recovering the exit code of localization.sh, we
can infer whether the localization tasks failed

The first couple commits in this PR represent a flawed approach: wrapping everything in setup.sh with set -e/set +e
was problematic because it prevents teardown.sh from ever running — since set -e
get sourced, any errors during localization halt entrypoint.sh immediately.

@coveralls
Copy link

coveralls commented Mar 31, 2020

Coverage Status

Coverage increased (+0.2%) to 59.523% when pulling 2e682a4 on julianhess:set_eee into fcbb115 on broadinstitute:master.

Previously, setup.sh did three things:
* Create directory structure for the task
* Export environment variables for the task
* Perform any localization tasks (i.e., gsutil cp/cat) for the task

We need to be able to catch errors arising from the third (localization) step.
However, the first two steps need to be sourced in entrypoint.sh, since they
export variables that must be available to script.sh when it's subsequently
invoked in entrypoint.sh. Sourcing all three steps makes it difficult to recover
any error codes from the localization step.

Thus, we now source the first two steps in entrypoint.sh (via setup.sh),
and break the localization tasks out into their own script (localization.sh),
which entrypoint.sh runs. By recovering the exit code of localization.sh, we
can infer whether the localization tasks failed

Our previous approach of wrapping everything in setup.sh with set -e/set +e
was problematic because it prevents teardown.sh from ever running -- since set -e
get *sourced*, any errors during localization halt entrypoint.sh immediately.
@julianhess julianhess changed the title Bookend setup.sh with set -e/unset -e Handle failures during setup.sh Apr 1, 2020
@agraubert agraubert merged commit bdfaaec into getzlab:master Apr 17, 2020
Bugs automation moved this from In Progress to Resolved Apr 17, 2020
@agraubert agraubert moved this from Resolved to In Progress in Bugs Apr 21, 2020
@agraubert agraubert moved this from In Progress to Resolved in Bugs Apr 21, 2020
@julianhess julianhess deleted the set_eee branch September 2, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Bugs
  
Resolved
Development

Successfully merging this pull request may close these issues.

None yet

3 participants