Skip to content

Commit

Permalink
Enable cloud cache based on environment variable (#4160)
Browse files Browse the repository at this point in the history

Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman authored Aug 8, 2023
1 parent ace32d0 commit a66b0e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ class PluginsFacade implements PluginStateListener {
specs << defaultPlugins.getPlugin('nf-wave')
}

// add cloudcache plugin when NXF_CLOUDCACHE_PATH is set
if( env.NXF_CLOUDCACHE_PATH ) {
specs << defaultPlugins.getPlugin('nf-cloudcache')
}

log.debug "Plugins resolved requirement=$specs"
return specs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class PluginsFacadeTest extends Specification {
given:
def defaults = new DefaultPlugins(plugins: [
'nf-amazon': new PluginSpec('nf-amazon', '0.1.0'),
'nf-cloudcache': new PluginSpec('nf-cloudcache', '0.1.0'),
'nf-google': new PluginSpec('nf-google', '0.1.0'),
'nf-tower': new PluginSpec('nf-tower', '0.1.0'),
'nf-wave': new PluginSpec('nf-wave', '0.1.0')
Expand Down Expand Up @@ -138,6 +139,12 @@ class PluginsFacadeTest extends Specification {
then:
result == [ new PluginSpec('nf-google','2.0.0') ]

when:
handler = new PluginsFacade(defaultPlugins: defaults, env: [NXF_CLOUDCACHE_PATH:'xyz'])
result = handler.pluginsRequirement([:])
then:
result == [ new PluginSpec('nf-cloudcache', '0.1.0') ]

}

def 'should return default plugins given config' () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CloudCacheStore implements CacheStore {
private Path defaultBasePath() {
final basePath = SysEnv.get('NXF_CLOUDCACHE_PATH')
if( !basePath )
throw new IllegalArgumentException("NXF_CLOUDCACHE_PATH must be defined when using the path-based cache store")
throw new IllegalArgumentException("NXF_CLOUDCACHE_PATH must be defined when using the cloud cache store")

return basePath as Path
}
Expand Down

0 comments on commit a66b0e6

Please sign in to comment.