Skip to content

Commit da3621c

Browse files
committed
Ensure main script is the first one in the lineage WorkflowRun record
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
1 parent 7ac4f3e commit da3621c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

modules/nf-lineage/src/main/nextflow/lineage/LinObserver.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class LinObserver implements TraceObserverV2 {
133133
}
134134

135135
protected List<DataPath> collectScriptDataPaths(PathNormalizer normalizer) {
136-
final allScripts = allScriptFiles()
136+
final allScripts = allScriptFiles().sort()
137137
final result = new ArrayList<DataPath>(allScripts.size()+1)
138138
// the main script
139139
result.add( new DataPath(
@@ -148,7 +148,7 @@ class LinObserver implements TraceObserverV2 {
148148
final dataPath = new DataPath(normalizer.normalizePath(it.normalize()), Checksum.ofNextflow(it.text))
149149
result.add(dataPath)
150150
}
151-
return result.sort{it.path}
151+
return result
152152
}
153153

154154
protected String storeWorkflowRun(PathNormalizer normalizer) {

modules/nf-lineage/src/test/nextflow/lineage/LinObserverTest.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class LinObserverTest extends Specification {
114114
def store = new DefaultLinStore();
115115
def uniqueId = UUID.randomUUID()
116116
def scriptFile = folder.resolve("main.nf")
117-
def module1 = folder.resolve("script1.nf"); module1.text = 'hola'
118-
def module2 = folder.resolve("script2.nf"); module2.text = 'world'
117+
def module1 = folder.resolve("a_script1.nf"); module1.text = 'hola'
118+
def module2 = folder.resolve("b_script2.nf"); module2.text = 'world'
119119
and:
120120

121121
def metadata = Mock(WorkflowMetadata){
@@ -139,7 +139,7 @@ class LinObserverTest extends Specification {
139139
when:
140140
def files = observer.collectScriptDataPaths(new PathNormalizer(metadata))
141141
then:
142-
observer.allScriptFiles() >> [ scriptFile, module1, module2 ]
142+
observer.allScriptFiles() >> [ module2, scriptFile, module1 ]
143143
and:
144144
files.size() == 3
145145
and:

0 commit comments

Comments
 (0)