Skip to content

Commit

Permalink
fix test regression due to null runtime pipeline set
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadedin committed Dec 8, 2024
1 parent 06c7232 commit c95ae7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/groovy/bpipe/Pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,8 @@ public class Pipeline implements ResourceRequestor {

pipeline.loadExternalStages()
pipeline.joiners += segmentJoiners

Runner.running = true

def mode = Config.config.mode
if(mode in ["run","documentation","register","resume"]) // todo: documentation should be its own mode! but can't support that right now
Expand Down Expand Up @@ -655,8 +657,8 @@ public class Pipeline implements ResourceRequestor {
* and both decrements and notifies the given counter when finished.
*/
void runSegment(def inputs, Closure s) {
Pipeline prevPipeline = currentRuntimePipeline.get()
try {

currentRuntimePipeline.set(this)

this.rootContext = createContext()
Expand Down Expand Up @@ -735,8 +737,9 @@ public class Pipeline implements ResourceRequestor {
log.info "Finished running segment in thread ${Thread.currentThread().id} for inputs $inputs"
Concurrency.instance.unregisterResourceRequestor(this)

if(currentRuntimePipeline.get() == this)
currentRuntimePipeline.set(null)
if(currentRuntimePipeline.get() == this && !Runner.running) {
currentRuntimePipeline.set(prevPipeline)
}
}
}

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

final static String canonicalRunDirectory = new File(runDirectory).canonicalPath

public static boolean running = false

// Populated just prior to launch
static String scriptDirectory = null

Expand Down

0 comments on commit c95ae7e

Please sign in to comment.