Skip to content

Commit 41e83f4

Browse files
committed
Wrap nimble docker run internal command in bash script to make debugging easier
1 parent dd61cec commit 41e83f4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

singlecell/src/org/labkey/singlecell/run/NimbleHelper.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ private File getNimbleDoneFile(File parentDir, String resumeString)
399399
private boolean runUsingDocker(List<String> nimbleArgs, PipelineStepOutput output, String resumeString) throws PipelineJobException
400400
{
401401
File localBashScript = new File(getPipelineCtx().getWorkingDirectory(), "docker.sh");
402+
File dockerBashScript = new File(getPipelineCtx().getWorkingDirectory(), "dockerRun.sh");
402403
output.addIntermediateFile(localBashScript);
404+
output.addIntermediateFile(dockerBashScript);
403405

404406
// Create temp folder:
405407
File tmpDir = new File(getPipelineCtx().getWorkingDirectory(), "tmpDir");
@@ -417,7 +419,7 @@ private boolean runUsingDocker(List<String> nimbleArgs, PipelineStepOutput outpu
417419
}
418420
output.addIntermediateFile(tmpDir);
419421

420-
try (PrintWriter writer = PrintWriters.getPrintWriter(localBashScript))
422+
try (PrintWriter writer = PrintWriters.getPrintWriter(localBashScript);PrintWriter dockerWriter = PrintWriters.getPrintWriter(dockerBashScript))
421423
{
422424
writer.println("#!/bin/bash");
423425
writer.println("set -x");
@@ -444,11 +446,19 @@ private boolean runUsingDocker(List<String> nimbleArgs, PipelineStepOutput outpu
444446
writer.println("\t--entrypoint /bin/bash \\");
445447
writer.println("\t-w /work \\");
446448
writer.println("\t" + DOCKER_CONTAINER_NAME + " \\");
447-
// TODO: eventually remove this:
448-
writer.println("\t /bin/bash -c \"" + StringUtils.join(nimbleArgs, " ") + "; echo 'Exit code: '$?; ls /work \"");
449+
writer.println("\t/work/" + dockerBashScript.getName());
449450
writer.println("EXIT_CODE=$?");
450-
writer.println("echo 'Bash script complete: '$EXIT_CODE");
451+
writer.println("echo 'Docker run exit code: '$EXIT_CODE");
451452
writer.println("exit $EXIT_CODE");
453+
454+
dockerWriter.println("#!/bin/bash");
455+
dockerWriter.println("set -x");
456+
457+
dockerWriter.println(StringUtils.join(nimbleArgs, " "));
458+
dockerWriter.println("EXIT_CODE=$?");
459+
dockerWriter.println("echo 'Exit code: '$?");
460+
dockerWriter.println("ls /work");
461+
dockerWriter.println("exit $EXIT_CODE");
452462
}
453463
catch (IOException e)
454464
{

0 commit comments

Comments
 (0)