Skip to content
Open

Dry run #4214

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
5 changes: 5 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,11 @@ The `run` command is used to execute a local pipeline script or remote pipeline
`-disable-jobs-cancellation`
: Prevent the cancellation of child jobs on execution termination

`-dry`
: :::{versionadded} 25.10.0
:::
: Print the tasks that will be executed, then exit without executing any tasks. Can be combined with `-resume` to test how much a previous run can be resumed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: Print the tasks that will be executed, then exit without executing any tasks. Can be combined with `-resume` to test how much a previous run can be resumed.
: Print the tasks that will be executed, then exit without executing any tasks. Can be combined with `-resume` to test how much of a previous run can be resumed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check meaning is retained.


`-dsl1`
: :::{deprecated} 23.09.0-edge
:::
Expand Down
10 changes: 9 additions & 1 deletion modules/nextflow/src/main/groovy/nextflow/Session.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ class Session implements ISession {
*/
boolean resumeMode

/**
* whenever it has been launched as a dry run
*/
boolean dryRun

/**
* The folder where workflow outputs are stored
*/
Expand Down Expand Up @@ -363,11 +368,14 @@ class Session implements ISession {
}
log.debug "Session UUID: $uniqueId"

// -- dry run
this.dryRun = config.dryRun

// -- set the run name
this.runName = config.runName ?: NameGenerator.next()
log.debug "Run name: $runName"

// -- dry run
// -- stub run
this.stubRun = config.stubRun

// -- preview
Expand Down
3 changes: 3 additions & 0 deletions modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ class CmdRun extends CmdBase implements HubOptions {
@Parameter(names=['-resume'], description = 'Execute the script using the cached results, useful to continue executions that was stopped by an error')
String resume

@Parameter(names=['-dry'], description = 'Print the tasks that will be executed, then exit without executing any tasks')
boolean dryRun

@Parameter(names=['-ps','-pool-size'], description = 'Number of threads in the execution pool', hidden = true)
Integer poolSize

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ class ConfigBuilder {
if( cmdRun.resume )
config.resume = cmdRun.resume

// -- sets the dry run option
if( cmdRun.dryRun ) {
config.dryRun = cmdRun.dryRun
}

if( config.isSet('resume') )
config.resume = normalizeResumeId(config.resume as String)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import nextflow.executor.CachedTaskHandler
import nextflow.executor.Executor
import nextflow.executor.StoredTaskHandler
import nextflow.extension.CH
import nextflow.extension.ChannelEx
import nextflow.extension.DataflowHelper
import nextflow.file.FileHelper
import nextflow.file.FileHolder
Expand Down Expand Up @@ -825,6 +826,12 @@ class TaskProcessor {
continue
}

if( session.dryRun ) {
log.info "[DRY RUN] execute task > ${safeTaskName(task)} [${hash}]"
ChannelEx.update(state) { StateObj it -> it.incCompleted() }
break
}

final lock = lockManager.acquire(hash)
final workDir = task.getWorkDirFor(hash)
try {
Expand Down