File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed
modules/nextflow/src/main/groovy/nextflow Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ import nextflow.trace.TraceObserverV2
77
77
import nextflow.trace.TraceRecord
78
78
import nextflow.trace.WorkflowStatsObserver
79
79
import nextflow.trace.event.FilePublishEvent
80
+ import nextflow.trace.event.FileStagingEvent
80
81
import nextflow.trace.event.TaskEvent
81
82
import nextflow.trace.event.WorkflowOutputEvent
82
83
import nextflow.util.Barrier
@@ -1114,6 +1115,9 @@ class Session implements ISession {
1114
1115
void notifyFilePublish (FilePublishEvent event ) {
1115
1116
notifyEvent(observersV1, ob -> ob. onFilePublish(event. target, event. source))
1116
1117
notifyEvent(observersV2, ob -> ob. onFilePublish(event))
1118
+
1119
+ void notifyFileStaged(FileStagingEvent event) {
1120
+ notifyEvent(observersV2, ob -> ob. onFileStaged(event))
1117
1121
}
1118
1122
1119
1123
void notifyFlowComplete() {
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import groovy.transform.ToString
39
39
import groovy.util.logging.Slf4j
40
40
import nextflow.Session
41
41
import nextflow.exception.ProcessStageException
42
+ import nextflow.trace.event.FileStagingEvent
42
43
import nextflow.extension.FilesEx
43
44
import nextflow.util.CacheHelper
44
45
import nextflow.util.Duration
@@ -100,6 +101,15 @@ class FilePorter {
100
101
if ( batch. size() ) {
101
102
log. trace " Stage foreign files: $batch "
102
103
submitStagingActions(batch. foreignPaths)
104
+
105
+ // Notify observers about file staging completion events
106
+ for ( FileCopy copy : batch. foreignPaths ) {
107
+ session. notifyFileStaged(new FileStagingEvent (
108
+ source : copy. source,
109
+ target : copy. target
110
+ ))
111
+ }
112
+
103
113
log. trace " Stage foreign files completed: $batch "
104
114
}
105
115
}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import groovy.transform.CompileStatic
21
21
import nextflow.Session
22
22
import nextflow.processor.TaskProcessor
23
23
import nextflow.trace.event.FilePublishEvent
24
+ import nextflow.trace.event.FileStagingEvent
24
25
import nextflow.trace.event.TaskEvent
25
26
import nextflow.trace.event.WorkflowOutputEvent
26
27
@@ -135,4 +136,11 @@ interface TraceObserverV2 {
135
136
*/
136
137
default void onFilePublish(FilePublishEvent event) {}
137
138
139
+ /**
140
+ * Invoked when a file staging operation completes (after the file has been copied).
141
+ *
142
+ * @param event
143
+ */
144
+ default void onFileStaged(FileStagingEvent event) {}
145
+
138
146
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2013-2024, Seqera Labs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package nextflow.trace.event
18
+
19
+ import java.nio.file.Path
20
+
21
+ import groovy.transform.Canonical
22
+ import groovy.transform.CompileStatic
23
+
24
+ /**
25
+ * Models a file staging event.
26
+ *
27
+ * @author Robrecht Cannoodt <robrecht.cannoodt@gmail.com>
28
+ */
29
+ @Canonical
30
+ @CompileStatic
31
+ class FileStagingEvent {
32
+ /**
33
+ * The original source path (e.g., remote URL or path).
34
+ */
35
+ Path source
36
+ /**
37
+ * The target staged path in the work directory.
38
+ */
39
+ Path target
40
+ }
You can’t perform that action at this time.
0 commit comments