Skip to content

Commit c2586ee

Browse files
committed
Switch docker to conditionally mount volumes based on provider
1 parent c540e99 commit c2586ee

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

primeseq/src/org/labkey/primeseq/pipeline/ExacloudResourceSettings.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
import org.json.JSONObject;
44
import org.labkey.api.data.Container;
55
import org.labkey.api.module.ModuleLoader;
6+
import org.labkey.api.pipeline.PipeRoot;
7+
import org.labkey.api.pipeline.PipelineService;
68
import org.labkey.api.sequenceanalysis.pipeline.JobResourceSettings;
79
import org.labkey.api.sequenceanalysis.pipeline.ToolParameterDescriptor;
810
import org.labkey.primeseq.PrimeseqModule;
911

1012
import java.util.Arrays;
13+
import java.util.Collection;
14+
import java.util.HashSet;
1115
import java.util.List;
16+
import java.util.Set;
1217

1318
/**
1419
* Created by bimber on 9/30/2016.
@@ -43,4 +48,37 @@ public boolean isAvailable(Container c)
4348
{
4449
return c.getActiveModules().contains(ModuleLoader.getInstance().getModule(PrimeseqModule.class));
4550
}
51+
52+
@Override
53+
public Collection<String> getDockerVolumes(Container c)
54+
{
55+
Set<String> volumes = new HashSet<>();
56+
volumes.add("/home/groups/prime-seq");
57+
volumes.add("/home/exacloud/gscratch");
58+
59+
PipeRoot pr = PipelineService.get().findPipelineRoot(c);
60+
if (pr != null && pr.getRootPath().exists())
61+
{
62+
if (pr.getRootPath().getPath().startsWith("/home/groups/"))
63+
{
64+
String folderName = pr.getRootPath().getPath().replaceAll("^/home/groups/", "").split("/")[0];
65+
volumes.add("/home/groups/" + folderName);
66+
}
67+
}
68+
69+
if (c.isWorkbook())
70+
{
71+
PipeRoot pr2 = PipelineService.get().findPipelineRoot(c.getParent());
72+
if (pr2 != null && pr2.getRootPath().exists())
73+
{
74+
if (pr2.getRootPath().getPath().startsWith("/home/groups/"))
75+
{
76+
String folderName = pr2.getRootPath().getPath().replaceAll("^/home/groups/", "").split("/")[0];
77+
volumes.add("/home/groups/" + folderName);
78+
}
79+
}
80+
}
81+
82+
return volumes;
83+
}
4684
}

0 commit comments

Comments
 (0)