forked from BimberLab/DiscvrLabKeyModules
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from LabKey/fb_merge_24.3_to_develop
Merge 24.3 to develop
- Loading branch information
Showing
50 changed files
with
1,574 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/run/DockerWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package org.labkey.api.sequenceanalysis.run; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.logging.log4j.Logger; | ||
import org.labkey.api.pipeline.PipelineJobException; | ||
import org.labkey.api.sequenceanalysis.pipeline.PipelineOutputTracker; | ||
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; | ||
import org.labkey.api.writer.PrintWriters; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class DockerWrapper extends AbstractCommandWrapper | ||
{ | ||
private final String _containerName; | ||
private File _tmpDir = null; | ||
|
||
public DockerWrapper(String containerName, Logger log) | ||
{ | ||
super(log); | ||
_containerName = containerName; | ||
} | ||
|
||
public void setTmpDir(File tmpDir) | ||
{ | ||
_tmpDir = tmpDir; | ||
} | ||
|
||
public void executeWithDocker(List<String> containerArgs, File workDir, PipelineOutputTracker tracker) throws PipelineJobException | ||
{ | ||
File localBashScript = new File(workDir, "docker.sh"); | ||
File dockerBashScript = new File(workDir, "dockerRun.sh"); | ||
tracker.addIntermediateFile(localBashScript); | ||
tracker.addIntermediateFile(dockerBashScript); | ||
|
||
setWorkingDir(workDir); | ||
try (PrintWriter writer = PrintWriters.getPrintWriter(localBashScript); PrintWriter dockerWriter = PrintWriters.getPrintWriter(dockerBashScript)) | ||
{ | ||
writer.println("#!/bin/bash"); | ||
writer.println("set -x"); | ||
writer.println("WD=`pwd`"); | ||
writer.println("HOME=`echo ~/`"); | ||
writer.println("DOCKER='" + SequencePipelineService.get().getDockerCommand() + "'"); | ||
writer.println("sudo $DOCKER pull " + _containerName); | ||
writer.println("sudo $DOCKER run --rm=true \\"); | ||
writer.println("\t-v \"${WD}:/work\" \\"); | ||
writer.println("\t-v \"${HOME}:/homeDir\" \\"); | ||
if (_tmpDir != null) | ||
{ | ||
writer.println("\t-v \"" + _tmpDir.getPath() + ":/tmp\" \\"); | ||
} | ||
writer.println("\t--entrypoint /bin/bash \\"); | ||
writer.println("\t-w /work \\"); | ||
Integer maxRam = SequencePipelineService.get().getMaxRam(); | ||
if (maxRam != null) | ||
{ | ||
writer.println("\t-e SEQUENCEANALYSIS_MAX_RAM=" + maxRam + " \\"); | ||
writer.println("\t--memory='" + maxRam + "g' \\"); | ||
} | ||
writer.println("\t" + _containerName + " \\"); | ||
writer.println("\t/work/" + dockerBashScript.getName()); | ||
writer.println("EXIT_CODE=$?"); | ||
writer.println("echo 'Docker run exit code: '$EXIT_CODE"); | ||
writer.println("exit $EXIT_CODE"); | ||
|
||
dockerWriter.println("#!/bin/bash"); | ||
dockerWriter.println("set -x"); | ||
dockerWriter.println(StringUtils.join(containerArgs, " ")); | ||
dockerWriter.println("EXIT_CODE=$?"); | ||
dockerWriter.println("echo 'Exit code: '$?"); | ||
dockerWriter.println("exit $EXIT_CODE"); | ||
} | ||
catch (IOException e) | ||
{ | ||
throw new PipelineJobException(e); | ||
} | ||
|
||
execute(Arrays.asList("/bin/bash", localBashScript.getPath())); | ||
} | ||
|
||
public File ensureLocalCopy(File input, File workingDirectory, PipelineOutputTracker output) throws PipelineJobException | ||
{ | ||
try | ||
{ | ||
if (workingDirectory.equals(input.getParentFile())) | ||
{ | ||
return input; | ||
} | ||
|
||
File local = new File(workingDirectory, input.getName()); | ||
if (!local.exists()) | ||
{ | ||
getLogger().debug("Copying file locally: " + input.getPath()); | ||
FileUtils.copyFile(input, local); | ||
} | ||
|
||
output.addIntermediateFile(local); | ||
|
||
return local; | ||
} | ||
catch (IOException e) | ||
{ | ||
throw new PipelineJobException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
SequenceAnalysis/resources/queries/sequenceanalysis/chain_files/.qview.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<customView xmlns="http://labkey.org/data/xml/queryCustomView"> | ||
<columns> | ||
<!--<column name="rowid" />--> | ||
<column name="genomeId1" /> | ||
<column name="genomeId2" /> | ||
<column name="source" /> | ||
<column name="version" /> | ||
<column name="datedisabled" /> | ||
<column name="chainFile" /> | ||
</columns> | ||
<sorts> | ||
<sort column="genomeId1/name"/> | ||
<sort column="genomeId2/name"/> | ||
<sort column="version"/> | ||
</sorts> | ||
</customView> |
17 changes: 17 additions & 0 deletions
17
SequenceAnalysis/resources/queries/sequenceanalysis/chain_files/With Filepath.qview.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<customView xmlns="http://labkey.org/data/xml/queryCustomView"> | ||
<columns> | ||
<!--<column name="rowid" />--> | ||
<column name="genomeId1" /> | ||
<column name="genomeId2" /> | ||
<column name="source" /> | ||
<column name="version" /> | ||
<column name="dateDisabled" /> | ||
<column name="chainFile" /> | ||
<column name="chainFile/DataFileUrl" /> | ||
</columns> | ||
<sorts> | ||
<sort column="genomeId1/name"/> | ||
<sort column="genomeId2/name"/> | ||
<sort column="version"/> | ||
</sorts> | ||
</customView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.