Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change task array submission commad in Google Batch #5780

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ abstract class TaskHandler {

/**
* Determine if a task is ready for execution or it depends on resources
* e.g. container that needs to be provisionied
* e.g. container that needs to be provisioned
*
* @return {@code true} when the task is ready for execution, {@code false} otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class GoogleBatchScriptLauncher extends BashWrapperBuilder implements GoogleBatc
private Path remoteBinDir
private Set<String> buckets = new HashSet<>()
private PathTrie pathTrie = new PathTrie()
private boolean isArray

/* ONLY FOR TESTING - DO NOT USE */
protected GoogleBatchScriptLauncher() {}
Expand Down Expand Up @@ -125,7 +126,9 @@ class GoogleBatchScriptLauncher extends BashWrapperBuilder implements GoogleBatc

@Override
String runCommand() {
launchCommand(workDirMount)
return isArray
? launchArrayCommand(workDirMount)
: launchCommand(workDirMount)
}

@Override
Expand Down Expand Up @@ -183,6 +186,20 @@ class GoogleBatchScriptLauncher extends BashWrapperBuilder implements GoogleBatc
return this
}

GoogleBatchScriptLauncher withIsArray(boolean value) {
this.isArray = value
return this
}

static String launchArrayCommand(String workDir ) {
// when executing a job array run directly the command script
// to prevent that all child jobs write on the same .command.*
// control files, causing an issue with the gcsfuse mount
// For the same reason the .command.log file is not uploaded
// See https://github.com/nextflow-io/nextflow/issues/5777
"/bin/bash ${workDir}/${TaskRun.CMD_SCRIPT}"
}

static String launchCommand( String workDir ) {
"trap \"{ cp ${TaskRun.CMD_LOG} ${workDir}/${TaskRun.CMD_LOG}; }\" ERR; /bin/bash ${workDir}/${TaskRun.CMD_RUN} 2>&1 | tee ${TaskRun.CMD_LOG}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class GoogleBatchTaskHandler extends TaskHandler implements FusionAwareTask {
final taskBean = task.toTaskBean()
return new GoogleBatchScriptLauncher(taskBean, executor.remoteBinDir)
.withConfig(executor.config)
.withIsArray(task.isArray())
}
}

Expand Down