public EverythingRunnerEngine(Tuple <string, Options> task, string outputFolder) { // set up directories to mount to docker container as volumes AnalysisDirectory = task != null ? task.Item2.AnalysisDirectory : outputFolder; var pathToConfig = Path.Combine(AnalysisDirectory, "configs"); if (!Directory.Exists(pathToConfig)) { Directory.CreateDirectory(pathToConfig); } ConfigDirectory = pathToConfig; var pathToDataFiles = Path.Combine(AnalysisDirectory, "data"); if (!Directory.Exists(pathToDataFiles)) { Directory.CreateDirectory(pathToDataFiles); } DataDirectory = pathToDataFiles; // path to workflow.txt PathToWorkflow = Path.Combine(AnalysisDirectory, "workflow_" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".txt"); SpritzContainerName = $"spritz{PathToWorkflow.GetHashCode()}"; }
public static readonly bool PrebuiltSpritzMods = true; // always using prebuilt library now public RunnerEngine(Tuple <string, SpritzOptions> task, string outputFolder) { // set up directories to mount to docker container as volumes AnalysisDirectory = task != null ? task.Item2.AnalysisDirectory : outputFolder; var pathToConfig = Path.Combine(AnalysisDirectory, "config"); if (!Directory.Exists(pathToConfig)) { Directory.CreateDirectory(pathToConfig); } ConfigDirectory = pathToConfig; ConfigFile = Path.Combine(ConfigDirectory, "config.yaml"); var resourcesPath = Path.Combine(Path.GetDirectoryName(AnalysisDirectory), "resources"); if (!Directory.Exists(resourcesPath)) { Directory.CreateDirectory(resourcesPath); } ResourcesDirectory = resourcesPath; // path to workflow.txt PathToWorkflow = Path.Combine(AnalysisDirectory, "workflow_" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".txt"); SpritzContainerName = $"spritz{PathToWorkflow.GetHashCode()}"; }
public string GenerateCommandsDry(string dockerImageName) { string command = ""; if (dockerImageName.Contains("smithlab")) { command += $"docker pull {dockerImageName} ;"; } command += $"docker run --rm -i -t --name {SpritzContainerName} " + $"-v \"\"\"{AnalysisDirectory}:/app/analysis" + "\"\"\" " + $"-v \"\"\"{DataDirectory}:/app/data" + "\"\"\" " + $"-v \"\"\"{ConfigDirectory}:/app/configs\"\"\" " + $"{dockerImageName}; docker stop spritz{PathToWorkflow.GetHashCode()}"; return(command); }
public string GenerateCommandsDry(string dockerImageName, string spritzCmdCommand) { string imageWithVersion = dockerImageName.Contains(":") ? dockerImageName : $"{dockerImageName}:{CurrentVersion}"; string command = dockerImageName.Contains("smithlab") ? $"docker pull {imageWithVersion};" : ""; command += $"docker run --rm -i -t --user=root --name {SpritzContainerName} " + $"-v \"\"\"{AnalysisDirectory}:/app/spritz/results/\"\"\" " + $"-v \"\"\"{ResourcesDirectory}:/app/spritz/resources\"\"\" " + $"{imageWithVersion} {spritzCmdCommand}; " + $"docker stop spritz{PathToWorkflow.GetHashCode()}"; return(command); }
public string GenerateTopComand() { return($"docker container top spritz{PathToWorkflow.GetHashCode()}"); }