Skip to content

Commit

Permalink
Check output parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Sep 10, 2024
1 parent 8e1f07c commit 3cf5b4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltObserver.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ class QuiltObserver implements TraceObserver {
String uri = "$value"
if (outputPrefixes.any { key.startsWith(it) && !key.contains('-') }) {
String[] splits = uri.split(':')
if (splits.size() == 0) {
log.warn("Output parameter not a URI: $uri")
if (splits.size() < 2) {
log.debug("Unrecognized URI[$uri] for key[$key] matching $outputPrefixes")
return
}
String scheme = splits[0]
if (scheme == 's3') {
uri = quiltURIfromS3(uri)
} else if (scheme != 'quilt+s3') {
log.warn("Unrecognized output URI: $uri")
log.warn("Unrecognized scheme:$scheme for output URI[$key]: $uri")
return
}
QuiltPath path = QuiltPathFactory.parse(uri)
Expand Down Expand Up @@ -146,6 +146,7 @@ class QuiltObserver implements TraceObserver {
boolean confirmQuiltPath(QuiltPath qPath) {
log.debug("confirmQuiltPath[$qPath]")
String key = pkgKey(qPath)
log.debug("confirmQuiltPath: key[$key] in outputURIs[${outputURIs.size()}]: $outputURIs")
return outputURIs.containsKey(key) ? true : false
}

Expand Down Expand Up @@ -174,11 +175,15 @@ class QuiltObserver implements TraceObserver {
checkConfig(session.config)
}

// NOTE: TraceFileObserver calls onFilePublish _before_ onFlowCreate
@Override
void onFilePublish(Path destination, Path source) {
// Path source may be null, won't work with older versions of Nextflow
log.debug("onFilePublish.Path[$destination] <- $source")
if (!outputURIs) {
// NOTE: TraceFileObserver calls onFilePublish _before_ onFlowCreate
log.debug('onFilePublish: no outputURIs yet')
return
}
QuiltPath qPath = asQuiltPath(destination)
boolean ok = (qPath != null) ? confirmQuiltPath(qPath) : canOverlayPath(destination, source)
if (!ok) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QuiltObserverTest extends QuiltSpecification {
Session mockSession(boolean success = false) {
String quilt_uri = 'quilt+s3://bucket#package=prefix%2fsuffix'
return GroovyMock(Session) {
getParams() >> [pubNot: 'foo', pubBad: 'foo:bar', outDir: SpecURI(), pubDir: testURI, inDir: quilt_uri]
getParams() >> [pubNot: 'foo', pubBad: 'foo:bar', outdir: SpecURI(), pubDir: testURI, inDir: quilt_uri]
isSuccess() >> success
config >> [quilt: [outputPrefixes: ['pub']]]
workDir >> Paths.get('./work')
Expand Down

0 comments on commit 3cf5b4a

Please sign in to comment.