Skip to content
Draft
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
40 changes: 32 additions & 8 deletions StepClasses/lib/perl/RunAndMonitorNextflow.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,25 @@ sub getConfigDeclaration {
}

sub runAndMonitor {
my ($self, $test, $user, $submitServer, $transferServer, $jobInfoFile, $logFile, $nextflowStdoutFile, $workingDir, $time, $queue, $nextflowWorkflow, $isGit, $clusterNextflowConfigFile) = @_;
my (
$self,
$test,
$user,
$submitServer,
$transferServer,
$jobInfoFile,
$logFile,
$nextflowStdoutFile,
$workingDir,
$time,
$queue,
$nextflowWorkflow,
$isGit,
$clusterNextflowConfigFile,
$clusterNextflowParamsFile,
$isNfCoreWorkflow,
$pipelineVersion,
) = @_;

if ($self->getSharedConfigRelaxed('masterWorkflowDataDir')) {
$self->log("Skipping runAndMonitorNextflow -- slave workflows don't run nextflow");
Expand All @@ -92,15 +110,21 @@ sub runAndMonitor {
# first see if by any chance we are already done (would happen if somehow the flow lost track of the job)
return 1 if $self->_checkClusterTaskLogForDone($logFile, $user, $transferServer);

#my $nextflowCmd = "nextflow run $nextflowWorkflow -with-trace -c $clusterNextflowConfigFile -resume >$nextflowStdoutFile 2>&1";
my $nextflowCmd = "nextflow"
if ($isNfCoreWorkflow) {
# here we want to inherit config from nf-core, and cant guarantee the default branch is 'main'
$nextflowCmd = "$nextflowCmd -c $clusterNextflowConfigFile run $nextflowWorkflow -with-trace -r $pipelineVersion -params-file $clusterNextflowParamsFile -resume >$nextflowStdoutFile 2>&1";
} else {
#use "-C" instead of "-c" to avoid taking from anything besides the specified config
my $nextflowCmd = "nextflow -C $clusterNextflowConfigFile run $nextflowWorkflow -with-trace -r main -resume >$nextflowStdoutFile 2>&1";
if($isGit){
$nextflowCmd = "nextflow pull $nextflowWorkflow; $nextflowCmd";
}
$nextflowCmd = "$nextflowCmd -C $clusterNextflowConfigFile run $nextflowWorkflow -with-trace -r main -resume >$nextflowStdoutFile 2>&1";
}

if($isGit || $isNfCoreWorkflow) {
$nextflowCmd = "nextflow pull $nextflowWorkflow; $nextflowCmd";
}

# prepend slash to ;, >, and & so that the command is submitted whole
$nextflowCmd =~ s{([;>&])}{\\$1}g;
# prepend slash to ;, >, and & so that the command is submitted whole
$nextflowCmd =~ s{([;>&])}{\\$1}g;

my $submitCmd = $self->getNodeClass()->getQueueSubmitCommand($queue, $nextflowCmd);

Expand Down