Skip to content

Commit

Permalink
Rebase script integrity check improvements (#4720) from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena authored and natefoo committed Oct 13, 2017
1 parent 545d555 commit 2f79351
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/galaxy/jobs/runners/util/job_script/__init__.py
@@ -1,3 +1,4 @@
import logging
import os
from string import Template
import subprocess
Expand All @@ -7,6 +8,7 @@
from six import text_type
from galaxy.util import unicodify

log = logging.getLogger(__name__)
DEFAULT_SHELL = '/bin/bash'

DEFAULT_JOB_FILE_TEMPLATE = Template(
Expand Down Expand Up @@ -122,18 +124,22 @@ def _handle_script_integrity(path, config):
script_integrity_verified = True
break

log.debug("Script integrity error: returncode was %d", returncode)

# Else we will sync and wait to see if the script becomes
# executable.
try:
# sync file system to avoid "Text file busy" problems.
# These have occurred both in Docker containers and on EC2 clusters
# under high load.
subprocess.check_call(INTEGRITY_SYNC_COMMAND)
except Exception:
pass
time.sleep(sleep_amt)
except Exception:
pass
except Exception as e:
log.debug("Error syncing the filesystem: %s", unicodify(e))

except Exception as exc:
log.debug("Script not available yet: %s", unicodify(exc))

time.sleep(sleep_amt)

if not script_integrity_verified:
raise Exception("Failed to write job script, could not verify job script integrity.")
Expand Down

0 comments on commit 2f79351

Please sign in to comment.