-
Notifications
You must be signed in to change notification settings - Fork 764
Task provenance #3802
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
Closed
Closed
Task provenance #3802
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
47d0168
Add initial task graph and metadata json file
bentsherman ae67027
Add task inputs and outputs to conrete DAG
bentsherman 8f95cd6
Fix failing tests
bentsherman 9f11e4b
Use path-based APIs to get file metadata
bentsherman db6aed1
Merge branch 'master' into ben-task-graph
bentsherman 8456892
Use buffer to compute checksum
bentsherman 0dd98d6
Merge branch 'master' into ben-task-graph-pull
bentsherman 0f505d3
Merge branch 'master' into ben-task-graph-pull
bentsherman e81e584
Replace synchronized with lock
bentsherman 35bac94
Refactor task graph to not depend on task directory naming
bentsherman 8bbe3d7
Replace abstract/concrete with process/task
bentsherman 7ec397f
Add support for AWS SSE env variables
pditommaso c0c7492
Merge branch 'master' into ben-task-graph-pull
bentsherman 49396cf
Fix failing tests
bentsherman 910a2f9
Merge branch 'master' into ben-task-graph-pull
bentsherman 0c63254
Rename 'process' option to 'workflow'
bentsherman 9b934e0
Save task inputs and outputs to cache db instead of json file
bentsherman 08fda25
Decouple task graph from DAG renderer
bentsherman 40a05e4
Merge branch 'master' into ben-task-graph
bentsherman 5eb9de1
Improve DAG rendering
bentsherman 47e595e
Merge branch 'master' into ben-task-graph
bentsherman c7422df
Add subworkflows to task graph
bentsherman cc8b6dc
Remove task DAG rendering (in favor of nf-prov)
bentsherman 8ed4c9f
Merge branch 'master' into ben-task-graph
bentsherman 73459b7
Revert unrelated changes
bentsherman d46b346
Remove unused code
bentsherman d851c2d
Use CacheHelper to compute MD5 checksum
bentsherman 501bce7
Add temporary debug logging
bentsherman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
modules/nextflow/src/main/groovy/nextflow/dag/ConcreteDAG.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /* | ||
| * Copyright 2013-2023, Seqera Labs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package nextflow.dag | ||
|
|
||
| import java.nio.file.Path | ||
| import java.util.regex.Pattern | ||
|
|
||
| import groovy.transform.MapConstructor | ||
| import groovy.transform.ToString | ||
| import groovy.util.logging.Slf4j | ||
| import nextflow.processor.TaskRun | ||
| import nextflow.script.params.FileOutParam | ||
| /** | ||
| * Model the conrete (task) graph of a pipeline execution. | ||
| * | ||
| * @author Ben Sherman <bentshermann@gmail.com> | ||
| */ | ||
| @Slf4j | ||
| class ConcreteDAG { | ||
|
|
||
| Map<String,Task> nodes = new HashMap<>(100) | ||
|
|
||
| /** | ||
| * Add a task to the graph | ||
| * | ||
| * @param task | ||
| */ | ||
| synchronized void addTask( TaskRun task ) { | ||
| final hash = task.hash.toString() | ||
| final label = "[${hash.substring(0,2)}/${hash.substring(2,8)}] ${task.name}" | ||
| final inputs = task.getInputFilesMap() | ||
| .collect { name, path -> | ||
| new Input(name: name, path: path, predecessor: getPredecessorHash(path)) | ||
| } | ||
|
|
||
| nodes[hash] = new Task( | ||
| index: nodes.size(), | ||
| label: label, | ||
| inputs: inputs | ||
| ) | ||
| } | ||
|
|
||
| static public String getPredecessorHash(Path path) { | ||
| final pattern = Pattern.compile('.*/([0-9a-f]{2}/[0-9a-f]{30})') | ||
| final matcher = pattern.matcher(path.toString()) | ||
|
|
||
| matcher.find() ? matcher.group(1).replace('/', '') : null | ||
| } | ||
|
|
||
| /** | ||
| * Add a task's outputs to the graph | ||
| * | ||
| * @param task | ||
| */ | ||
| synchronized void addTaskOutputs( TaskRun task ) { | ||
| final hash = task.hash.toString() | ||
| final outputs = task.getOutputsByType(FileOutParam) | ||
| .values() | ||
| .flatten() | ||
| .collect { path -> | ||
| new Output(name: path.name, path: path) | ||
| } | ||
|
|
||
| nodes[hash].outputs = outputs | ||
| } | ||
|
|
||
| @MapConstructor | ||
| @ToString(includeNames = true, includes = 'label', includePackage=false) | ||
| static protected class Task { | ||
| int index | ||
| String label | ||
| List<Input> inputs | ||
| List<Output> outputs | ||
|
|
||
| String getSlug() { "t${index}" } | ||
| } | ||
|
|
||
| @MapConstructor | ||
| static protected class Input { | ||
| String name | ||
| Path path | ||
| String predecessor | ||
| } | ||
|
|
||
| @MapConstructor | ||
| static protected class Output { | ||
| String name | ||
| Path path | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.