-
Notifications
You must be signed in to change notification settings - Fork 700
Data lineage tracking (aka CID store) #5715
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
Merged
Merged
Changes from 86 commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
472fcc7
Addressable data store
pditommaso 4f8c524
Merge branch 'master' into cid-store
pditommaso b5e8c46
Addressable data store [wip 2] [ci skip]
pditommaso 669afd5
Minor changes [ci skip]
pditommaso c93a713
Addressable data store
pditommaso c0c660f
Addressable data store [wip 2] [ci skip]
pditommaso 2a2d76f
Minor changes [ci skip]
pditommaso a2139e3
M0 implementation
jorgee fddc5f7
fix tests
jorgee fe780a8
fix tests
jorgee f9f7ed2
first M1 updates
jorgee 0c2492e
fix tests
jorgee 41ac817
update descriptions
jorgee cdc3116
fix test
jorgee 642e7b1
Merge branch 'master' into cid-store-m0
pditommaso 1400e80
Merge branch 'cid-store' of github.com:nextflow-io/nextflow into cid-…
pditommaso d64c71a
Merge branch 'master' into cid-store
pditommaso 975143f
Merge branch 'cid-store' into cid-store-m0
pditommaso 82b1ccd
First commit to M1 implementation
jorgee edfaf5b
fix NPE in tests
jorgee c207d92
Fix NPE in tests
jorgee f4b9031
Add CidStore factory
jorgee b89cdf1
fix cid paht hash validation
jorgee 54849d3
Merge branch 'master' into cid-store
jorgee fdbda27
Merge branch 'cid-store' into cid-store-m0
jorgee 84ee951
Merge branch 'master' into cid-store-m0
pditommaso 0d1a74f
Merge pull request #5787 from nextflow-io/cid-store-m0 [ci fast]
pditommaso 34cc0b1
Cleanup and formatting
pditommaso bd96bc8
Decouple cid store from session (#5833) [ci fast]
pditommaso 4c0ef8f
Add cid command help
jorgee b9de3e6
Fix CID store errors when workflow outputs in s3
jorgee bebe947
Merge branch 'master' into cid-store
pditommaso 36d293f
Merge branch 'master' into cid-store
pditommaso 76f3494
Merge branch 'master' into cid-store
jorgee 063a0ec
Decouple CID FileSystem from Local file system and other fixes (#5866)
jorgee acabc9c
Merge branch 'master' into cid-store
pditommaso 3e2ca19
Just blank [ci skip]
pditommaso 90c8e38
fix unexpected warning in cidpath hash validation
jorgee 5276645
Refactor CID store as plugin (#5877)
pditommaso be2fefc
Merge with master@00a53b97 [ci fast]
pditommaso 9de3b04
Merge branch 'master' into cid-store
pditommaso 16f74b4
Restore unneeded changes [ci fast]
pditommaso eb14d4b
Add CID H2 plugin (#5889)
pditommaso c04a58f
Merge branch 'master' into cid-store
pditommaso db79c43
Add serde interfaces (#5893) [ci skip]
pditommaso 6b3293b
PoC for CID store annotations and workflow outputs structure (#5885)
jorgee a5b5907
Merge branch 'master' into cid-store
jorgee 14e2841
Cid store quick wins (#5945)
jorgee 7cba5bd
Merge branch 'master' into cid-store
pditommaso 4073298
Just blanks [ci skip]
pditommaso 1b991ec
Clean up
pditommaso d6e77a3
Minor [ci fast]
pditommaso 4058c8e
Add checksum factory [ci fast]
pditommaso ffa3b7e
Fix typo [ci skip]
pditommaso 9b4addf
Simplify code [ci fast]
pditommaso 5692b67
Simplify cid workflow run scripts (#5949)
pditommaso 5ef0b91
Merge branch 'master' into cid-store
pditommaso 9c335f2
Merge branch 'master' into cid-store
pditommaso c9134e4
Cid store improve coverage, fixes and others (#5956)
jorgee f1a8770
Remove dot from message [ci fast]
pditommaso 10f2b87
Fix test on macOs [ci fast]
pditommaso d415099
Merge branch 'master' into cid-store [ci fast]
pditommaso 14ede8e
Update copyright [ci fast]
pditommaso 802a119
Nit formatting [ci skip]
pditommaso 10082ca
Fix failing tests [ci fast]
pditommaso 7bff926
Refactor RealPathAware to LogicalPath [ci fast]
pditommaso a8765e6
Minor change [ci skip]
pditommaso 3c93ee9
CID consolidation (#5969) [ci fast]
jorgee 23279ac
Merge branch 'master' into cid-store
jorgee f7d84ba
fix merged publishop
jorgee 1c06e69
Fix failing test on mac [ci fast]
pditommaso 9f41c28
change getTargetPath with flags to different methods
jorgee f43e46c
change resolved config from string to map
jorgee 5208c38
CID to lineage rename (#5977)
jorgee abf0c3a
fixes render, hint of closer property name
jorgee ac7f675
Just blanks [ci fast]
pditommaso 4c9f8e0
Minor changes
pditommaso 306fbaf
Fix failing tests [ci fast]
pditommaso 226bf65
Add support for command aliases [ci fast]
pditommaso 38735b0
cleanup code style
bentsherman 6d71bc9
replace nested ifs with if-guards
bentsherman 52e3333
change default render file name to `lineage.html`
bentsherman baed1ad
fix typo
bentsherman d3bc077
Merge branch 'master' into cid-store
bentsherman e7f437b
cleanup whitespace
bentsherman 52664ce
don't wrap singleton file output as a list
bentsherman 36d5c82
fix failing test
bentsherman 10e7e7e
remove unnecesary method in taskId
jorgee 119d2f8
renames and small fixes
jorgee 034665c
fix tests
jorgee 119b1d9
Minor changes [ci fast]
pditommaso 403c2e5
Merge branch 'master' into cid-store
pditommaso d186742
[ci fast] merge master
pditommaso 303807b
Remove h2 plugin [ci fast]
pditommaso 83f5647
Simplified config [ci fast]
pditommaso 854a9de
Fix failing tests [ci fast]
pditommaso 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
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
291 changes: 291 additions & 0 deletions
291
modules/nextflow/src/main/groovy/nextflow/cli/CmdLineage.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,291 @@ | ||
/* | ||
* Copyright 2013-2025, 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.cli | ||
|
||
import java.nio.file.Paths | ||
|
||
import com.beust.jcommander.Parameter | ||
import com.beust.jcommander.Parameters | ||
import groovy.transform.CompileStatic | ||
import nextflow.config.ConfigBuilder | ||
import nextflow.config.ConfigMap | ||
import nextflow.exception.AbortOperationException | ||
import nextflow.plugin.Plugins | ||
import org.pf4j.ExtensionPoint | ||
|
||
/** | ||
* CID command line interface | ||
* | ||
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com> | ||
*/ | ||
@CompileStatic | ||
@Parameters(commandDescription = "Explore workflows lineage metadata", commandNames = ['li']) | ||
class CmdLineage extends CmdBase implements UsageAware { | ||
|
||
private static final String NAME = 'lineage' | ||
|
||
interface LinCommand extends ExtensionPoint { | ||
void log(ConfigMap config) | ||
void describe(ConfigMap config, List<String> args) | ||
void render(ConfigMap config, List<String> args) | ||
void diff(ConfigMap config, List<String> args) | ||
void find(ConfigMap config, List<String> args) | ||
} | ||
|
||
interface SubCmd { | ||
String getName() | ||
String getDescription() | ||
void apply(List<String> args) | ||
void usage() | ||
} | ||
|
||
private List<SubCmd> commands = new ArrayList<>() | ||
|
||
private LinCommand operation | ||
|
||
private ConfigMap config | ||
|
||
CmdLineage() { | ||
commands << new CmdLog() | ||
commands << new CmdDescribe() | ||
commands << new CmdRender() | ||
commands << new CmdDiff() | ||
commands << new CmdFind() | ||
} | ||
|
||
@Parameter(hidden = true) | ||
List<String> args | ||
|
||
@Override | ||
String getName() { | ||
return NAME | ||
} | ||
|
||
@Override | ||
void run() { | ||
if( !args ) { | ||
usage(List.of()) | ||
return | ||
} | ||
// setup the plugins system and load the secrets provider | ||
Plugins.init() | ||
// load the config | ||
this.config = new ConfigBuilder() | ||
.setOptions(launcher.options) | ||
.setBaseDir(Paths.get('.')) | ||
.build() | ||
// init plugins | ||
Plugins.load(config) | ||
// load the command operations | ||
this.operation = Plugins.getExtension(LinCommand) | ||
if( !operation ) | ||
throw new IllegalStateException("Unable to load lineage extensions.") | ||
// consume the first argument | ||
getCmd(args).apply(args.drop(1)) | ||
} | ||
|
||
/** | ||
* Print the command usage help | ||
*/ | ||
void usage() { | ||
usage(args) | ||
} | ||
|
||
/** | ||
* Print the command usage help | ||
* | ||
* @param args The arguments as entered by the user | ||
*/ | ||
void usage(List<String> args) { | ||
if( !args ) { | ||
List<String> result = [] | ||
result << this.getClass().getAnnotation(Parameters).commandDescription() | ||
result << "Usage: nextflow $NAME <sub-command> [options]".toString() | ||
result << '' | ||
result << 'Commands:' | ||
int len = 0 | ||
commands.forEach {len = it.name.size() > len ? it.name.size() : len } | ||
commands.sort(){it.name}.each { result << " ${it.name.padRight(len)}\t${it.description}".toString() } | ||
result << '' | ||
println result.join('\n').toString() | ||
} | ||
else { | ||
def sub = commands.find { it.name == args[0] } | ||
if( sub ) | ||
sub.usage() | ||
else { | ||
throw new AbortOperationException("Unknown $NAME sub-command: ${args[0]}") | ||
} | ||
} | ||
} | ||
|
||
protected SubCmd getCmd(List<String> args) { | ||
|
||
def cmd = commands.find { it.name == args[0] } | ||
if( cmd ) { | ||
return cmd | ||
} | ||
|
||
def matches = commands.collect{ it.name }.closest(args[0]) | ||
def msg = "Unknown cloud sub-command: ${args[0]}" | ||
if( matches ) | ||
msg += " -- Did you mean one of these?\n" + matches.collect { " $it"}.join('\n') | ||
throw new AbortOperationException(msg) | ||
} | ||
|
||
class CmdLog implements SubCmd { | ||
|
||
@Override | ||
String getName() { | ||
return 'log' | ||
} | ||
|
||
@Override | ||
String getDescription() { | ||
return 'Print the lineage execution log' | ||
} | ||
|
||
@Override | ||
void apply(List<String> args) { | ||
if (args.size() != 0) { | ||
println("ERROR: Incorrect number of parameters") | ||
usage() | ||
return | ||
} | ||
operation.log(config) | ||
} | ||
|
||
@Override | ||
void usage() { | ||
println description | ||
println "Usage: nextflow $NAME $name" | ||
} | ||
} | ||
|
||
class CmdDescribe implements SubCmd{ | ||
|
||
@Override | ||
String getName() { | ||
return 'describe' | ||
} | ||
|
||
@Override | ||
String getDescription() { | ||
return 'Print the description of a Lineage ID (lid)' | ||
} | ||
|
||
void apply(List<String> args) { | ||
if (args.size() != 1) { | ||
println("ERROR: Incorrect number of parameters") | ||
usage() | ||
return | ||
} | ||
|
||
operation.describe(config, args) | ||
} | ||
|
||
@Override | ||
void usage() { | ||
println description | ||
println "Usage: nextflow $NAME $name <lid> " | ||
} | ||
} | ||
|
||
class CmdRender implements SubCmd { | ||
|
||
@Override | ||
String getName() { 'render' } | ||
|
||
@Override | ||
String getDescription() { | ||
return 'Render the lineage graph for a workflow output' | ||
} | ||
|
||
void apply(List<String> args) { | ||
if (args.size() < 1 || args.size() > 2) { | ||
println("ERROR: Incorrect number of parameters") | ||
usage() | ||
return | ||
} | ||
|
||
operation.render(config, args) | ||
} | ||
|
||
@Override | ||
void usage() { | ||
println description | ||
println "Usage: nextflow $NAME $name <workflow output lid> [<html output file>]" | ||
} | ||
|
||
} | ||
|
||
class CmdDiff implements SubCmd { | ||
|
||
@Override | ||
String getName() { 'diff' } | ||
|
||
@Override | ||
String getDescription() { | ||
return 'Show differences between two lineage descriptions' | ||
} | ||
|
||
void apply(List<String> args) { | ||
if (args.size() != 2) { | ||
println("ERROR: Incorrect number of parameters") | ||
usage() | ||
return | ||
} | ||
operation.diff(config, args) | ||
} | ||
|
||
@Override | ||
void usage() { | ||
println description | ||
println "Usage: nextflow $NAME $name <lid-1> <lid-2>" | ||
} | ||
|
||
} | ||
|
||
class CmdFind implements SubCmd { | ||
|
||
@Override | ||
String getName() { 'find' } | ||
|
||
@Override | ||
String getDescription() { | ||
return 'Find lineage metadata descriptions matching with a query' | ||
} | ||
|
||
void apply(List<String> args) { | ||
if (args.size() != 1) { | ||
println("ERROR: Incorrect number of parameters") | ||
usage() | ||
return | ||
} | ||
operation.find(config, args) | ||
} | ||
|
||
@Override | ||
void usage() { | ||
println description | ||
println "Usage: nextflow $NAME $name <query>" | ||
} | ||
|
||
} | ||
|
||
} |
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.
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.