Skip to content

Commit ed7777b

Browse files
committed
feat(nf-google): fold in nextflow-io#6917 that defaults to copy stageout mode
1 parent c0e3c09 commit ed7777b

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

plugins/nf-google/src/main/nextflow/cloud/google/batch/GoogleBatchScriptLauncher.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class GoogleBatchScriptLauncher extends BashWrapperBuilder implements GoogleBatc
5858
protected GoogleBatchScriptLauncher() {}
5959

6060
GoogleBatchScriptLauncher(TaskBean bean, Path remoteBinDir, BatchConfig batchConfig) {
61+
// Unstaging is cross-device on Google Batch (gcsfuse-mounted work dir).
62+
// `move` can fail with overlapping outputs or symlinked paths.
63+
if( bean.stageOutMode == null )
64+
bean.stageOutMode = 'copy'
6165
super(bean, copyStrategyFor(bean, batchConfig))
6266
// keep track the google storage work dir
6367
this.remoteWorkDir = (CloudStoragePath) bean.workDir

plugins/nf-google/src/test/nextflow/cloud/google/batch/GoogleBatchScriptLauncherTest.groovy

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
package nextflow.cloud.google.batch
1818

1919
import java.nio.file.Paths
20-
2120
import com.google.cloud.storage.contrib.nio.CloudStorageFileSystem
2221
import nextflow.cloud.google.GoogleOpts
2322
import nextflow.cloud.google.batch.client.BatchConfig
23+
import nextflow.processor.TaskBean
2424
import nextflow.processor.TaskRun
2525
import spock.lang.Specification
2626
import spock.lang.Unroll
@@ -87,6 +87,24 @@ class GoogleBatchScriptLauncherTest extends Specification{
8787
volumes[1].getMountOptionsList() == ['-o rw', '-implicit-dirs', '-o allow_other', '--uid=1000', '--billing-project my-project']
8888
}
8989

90+
def 'should default stageOutMode to copy when not set' () {
91+
given:
92+
def workDir = CloudStorageFileSystem.forBucket('foo').getPath('/scratch')
93+
def targetDir = CloudStorageFileSystem.forBucket('foo').getPath('/scratch')
94+
def bean = new TaskBean(
95+
workDir: workDir,
96+
targetDir: targetDir,
97+
stageOutMode: null,
98+
inputFiles: [:]
99+
)
100+
101+
when:
102+
new GoogleBatchScriptLauncher(bean, null, Mock(BatchConfig))
103+
104+
then:
105+
bean.stageOutMode == 'copy'
106+
}
107+
90108
def 'should return target files in remote work dir' () {
91109
given:
92110
def launcher = new GoogleBatchScriptLauncher()

0 commit comments

Comments
 (0)