Project

General

Profile

Actions

Bug #6845

closed

crunch job log doesn't print the commands it is running in a usable format (at least for `docker run` commands)

Added by Joshua Randall over 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
-
Story points:
-

Description

The crunch log contains entries of the form "Running [%s]" which is great because you can tell what is going on and it gives an idea of what to try running yourself when debugging issues.

However, I find that the format of the string printed for the command is often not interpretable by the shell as it is.

For example, a recent issue had me looking at a `docker run` command that looks like this (it is printed verbatim except that I've replaced the api token with the string "REDACTED"):

/usr/bin/docker run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=/tmp/crunch-job/7lnae-ot0gb-uphbxtgyirza00i-0.cid --sig-proxy --memory=250855092k --memory-swap=255049392k --dns 172.17.120.12 --dns 10.0.42.1 --volume=/tmp/crunch-job/src:/tmp/crunch-job/src:ro --volume=/tmp/crunch-job/opt:/tmp/crunch-job/opt:ro --volume=/tmp/crunch-job/task/ht-1-1-03.1.keep:/keep:ro --volume=/tmp --env=TASK_UUID=7lnae-ot0gb-uphbxtgyirza00i --env=TASK_SEQUENCE=0 --env=CRUNCH_INSTALL=/tmp/crunch-job/opt --env=CRUNCH_GIT_ARCHIVE_HASH=9c82b456df0eb72ed073426110660d14 --env=TASK_WORK=/tmp/crunch-job-task-work/ht-1-1-03.1 --env=JOB_SCRIPT=run-command --env=TASK_TMPDIR=/tmp/crunch-job-task-work/ht-1-1-03.1 --env=JOB_WORK=/tmp/crunch-job-work --env=CRUNCH_REFRESH_TRIGGER=/tmp/crunch_refresh_trigger --env=CRUNCH_SRC_COMMIT=83a9390a05bbffc2e4ea95dd693af3ab3547fa12 --env=ARVADOS_API_HOST_INSECURE=yes --env=TASK_SLOT_NUMBER=1 --env=ARVADOS_API_HOST=api.arvados.internal.sanger.ac.uk --env=CRUNCH_SRC_URL=/opt/arvados/arvados.internal.git --env=TASK_SLOT_NODE=ht-1-1-03 --env=JOB_PARAMETER_D=7eb6160977c6161fee4f365765d33801+2370 --env=JOB_PARAMETER_SAMPLE_ID=my_sample --env=TASK_QSEQUENCE=0 --env=CRUNCH_JOB_DOCKER_BIN=/usr/bin/docker --env=CRUNCH_JOB_BIN=/opt/arvados/sdk/cli/bin/crunch-job --env=TASK_KEEPMOUNT=/keep --env=ARVADOS_API_TOKEN=REDACTED --env=JOB_PARAMETER_REFERENCE=3514b8e5da0e8d109946bc809b20a78a+5698 --env=CRUNCH_TMP=/tmp/crunch-job --env=JOB_PARAMETER_TASK.FOREACH=ARRAY(0x24d18e8) --env=CRUNCH_NODE_SLOTS=1 --env=JOB_UUID=7lnae-8i9sb-6rj240jemkgjtky --env=JOB_PARAMETER_EACHREAD=$(dir $(d)) --env=CRUNCH_SRC=/tmp/crunch-job/src --env=JOB_PARAMETER_COMMAND=ARRAY(0x2181200) --env=JOB_PARAMETER_B=HASH(0x24d1a80) --env=CRUNCH_JOB_UUID=7lnae-8i9sb-6rj240jemkgjtky --env=JOB_PARAMETER_TASK.STDOUT=$(param) --env=CRUNCH_WORK=/tmp/crunch-job/work --env=JOB_PARAMETER_PARAM=HASH(0x24d18a0) --env=HOME=/tmp/crunch-job-task-work/ht-1-1-03.1 f4eafaf1e2d738e0f8d947feb725b5945f0219c5c4956eec6e164a0788abbab8 stdbuf --output=0 --error=0 perl - /tmp/crunch-job/src/crunch_scripts/run-command

Attempting to actually run this in the shell results in a syntax error:

bash: syntax error near unexpected token `('

This is because there are unescaped, unquoted parentheses in the string. If there are such characters, I'd suggest that they some shell escaping be applied before printing to the log, so that it is possible to copy and paste into a shell to try running it.

I also question whether the command run actually contained:

--env=JOB_PARAMETER_COMMAND=ARRAY(0x2181200)

Or whether the array was in actuality expanded into a string containing its values (in which case the same procedure should be applied to prepare the string for the log).

I implemented a fix for a similar issue in the command line printing for common-workflow-language (https://github.com/common-workflow-language/common-workflow-language/pull/93). I can take a look at a fix for this once I figure out where the messages are coming from...

Actions #1

Updated by Peter Amstutz over 4 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF