Skip to content

Commit

Permalink
support to delay pipeline start using argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadedin committed Aug 23, 2024
1 parent b2a1c32 commit c6bfed9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/groovy/bpipe/Pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,11 @@ public class Pipeline implements ResourceRequestor {
Runner.binding.readOnly = true
}

if(Runner.runDelayMs > 0L) {
println "\nMSG: Waiting ${Runner.runDelayMs}ms before starting ...\n"
Thread.sleep(Runner.runDelayMs)
}

runSegment(resolvedInputFiles, constructedPipeline)

if(failed) {
Expand Down
8 changes: 8 additions & 0 deletions src/main/groovy/bpipe/Runner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class Runner {

public static boolean cleanupRequired = false

public static long runDelayMs = 0L

/**
* Lock used to ensure only one instance of bpipe runs in a directory at a time
**/
Expand Down Expand Up @@ -513,6 +515,11 @@ class Runner {
println "\n" + " ( ${ansi().fgGreen()}Running in Dev mode for Stage ${ansi().fgBlue()}${opts['dev']}${ansi().fgDefault()} ) ".center((int)Config.config.columns, "=") + "\n"
Config.config.devAt = ((String)opts['dev']).split(",")
}


if(opts['delay']) {
runDelayMs = Integer.parseInt((String)opts['delay']) * 1000L
}

initThreads*.join(20000)

Expand Down Expand Up @@ -586,6 +593,7 @@ class Runner {
cli.with {
h longOpt:'help', 'usage information'
d longOpt:'dir', 'output directory', args:1
delay 'Delay in seconds before starting pipeline', longOpt: 'delay', args:1
a longOpt: 'autoarchive', 'clean up all internal files after run into given archive', args:1
t longOpt:'test', 'test mode'
f longOpt: 'filename', 'output file name of report', args:1
Expand Down

0 comments on commit c6bfed9

Please sign in to comment.