Skip to content

Commit a7002ed

Browse files
committed
analysis: temporal fix for HOME env variable, #TASK-6445
1 parent 62ffce0 commit a7002ed

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

opencga-analysis/src/main/java/org/opencb/opencga/analysis/workflow/NextFlowExecutor.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ protected void run() throws Exception {
199199
writeNextflowConfigFile(nextflowConfig, nextflowConfigPath, outDirPath);
200200
dockerInputBindings.add(new AbstractMap.SimpleEntry<>(nextflowConfigPath.toString(), nextflowConfigPath.toString()));
201201
} else {
202-
throw new RuntimeException("Can't fetch nextflow.config file");
202+
throw new ToolException("Can't fetch nextflow.config file");
203203
}
204204

205205
// Build output binding
@@ -233,8 +233,11 @@ protected void run() throws Exception {
233233
Map<String, String> dockerParams = new HashMap<>();
234234
// Set HOME environment variable to the temporal input directory. This is because nextflow creates a hidden folder there and,
235235
// when nextflow runs on other dockers, we need to store those files in a path shared between the parent docker and the host
236-
dockerParams.put("-e", "HOME=" + temporalInputDir);
237-
dockerParams.put("-e", "OPENCGA_TOKEN=" + getExpiringToken());
236+
// TODO: Temporal solution
237+
dockerParams.put("-e", "HOME=" + temporalInputDir + " -e OPENCGA_TOKEN=" + getExpiringToken());
238+
239+
// dockerParams.put("-e", "HOME=" + temporalInputDir);
240+
// dockerParams.put("-e", "OPENCGA_TOKEN=" + getExpiringToken());
238241
// Set user uid and guid to 1001
239242
dockerParams.put("user", "1001:1001");
240243

@@ -256,7 +259,7 @@ protected void close() {
256259
deleteTemporalFiles();
257260
}
258261

259-
private void writeNextflowConfigFile(URL inputUrl, Path outputFile, String outdirPath) {
262+
private void writeNextflowConfigFile(URL inputUrl, Path outputFile, String outdirPath) throws ToolException {
260263
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputUrl.openStream()));
261264
BufferedWriter writer = Files.newBufferedWriter(outputFile)) {
262265

@@ -268,7 +271,7 @@ private void writeNextflowConfigFile(URL inputUrl, Path outputFile, String outdi
268271
writer.newLine();
269272
}
270273
} catch (IOException e) {
271-
throw new RuntimeException(e);
274+
throw new ToolException("Could not replace 'nextflow.config' file contents", e);
272275
}
273276
}
274277

0 commit comments

Comments
 (0)