Skip to content

Commit 771b8b6

Browse files
pditommasoclaude
andauthored
Fix cache command to use SysEnv for cloudcache path check (#6432)
- Use SysEnv.get('NXF_CLOUDCACHE_PATH') instead of session.cloudCachePath - Add debug logging to distinguish between CacheManager and LogsHandler usage - Improves handling when command is used via Seqera Platform 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 13f4819 commit 771b8b6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/nf-tower/src/main/io/seqera/tower/plugin/CacheCommand.groovy

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package io.seqera.tower.plugin
1919

2020
import groovy.transform.CompileStatic
2121
import groovy.util.logging.Slf4j
22+
import nextflow.SysEnv
2223
import nextflow.cli.PluginAbstractExec
2324
/**
2425
* Implements nextflow cache and restore commands
@@ -43,12 +44,17 @@ class CacheCommand implements PluginAbstractExec {
4344
}
4445

4546
protected void cacheBackup() {
46-
log.debug "Running Nextflow cache backup"
47-
if( !getSession().cloudCachePath ) {
47+
// note: use directly NXF_CLOUDCACHE_PATH instead of `session.cloudCachePath`
48+
// because the latter required to be initialized via the execution
49+
// CmdRun. However this command is only executed to be used via Seqera Platform
50+
// that's providing the cache path via the env variable
51+
if( !SysEnv.get('NXF_CLOUDCACHE_PATH') ) {
52+
log.debug "Running Nextflow cache backup (CacheManager)"
4853
// legacy cache manager
4954
new CacheManager(System.getenv()).saveCacheFiles()
5055
}
5156
else {
57+
log.debug "Running Nextflow cache backup (LogsHandler)"
5258
new LogsHandler(getSession(), System.getenv()).saveFiles()
5359
}
5460
}

0 commit comments

Comments
 (0)