Skip to content

Commit

Permalink
Merge pull request #126 from CCBR/spooker
Browse files Browse the repository at this point in the history
Run spooker on workflow completion
  • Loading branch information
kelly-sovacool authored Oct 31, 2023
2 parents aa4d731 + 17a65d2 commit 8302666
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## development version

- Run spooker on workflow completion (#126).

## CHAMPAGNE 0.2.0

### New features
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
recursive-include assets
recursive-include bin
recursive-include conf
recursive-include lib
recursive-include modules
recursive-include src
recursive-include submodules
Expand Down
21 changes: 21 additions & 0 deletions lib/Utils.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Utils {
// run spooker for the workflow
public static String spooker(workflow) {
def pipeline_name = "${workflow.manifest.name.tokenize('/')[-1]}"
def command_string = "spooker ${workflow.launchDir} ${pipeline_name}"
def out = new StringBuilder()
def err = new StringBuilder()
try {
def command = command_string.execute()
command.consumeProcessOutput(out, err)
command.waitFor()
} catch(IOException e) {
err = e
}
new FileWriter("${workflow.launchDir}/log/spooker.log").with {
write("${out}\n${err}")
flush()
}
return err
}
}
8 changes: 8 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ include { PPQT_PROCESS
MULTIQC } from "./modules/local/qc.nf"
include { NORMALIZE_INPUT } from "./modules/local/deeptools.nf"

workflow.onComplete {
println "Running spooker"
def message = Utils.spooker(workflow)
if (message) {
println message
}
}

workflow MAKE_REFERENCE {
PREPARE_GENOME()
}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Changelog = "https://github.com/CCBR/CHAMPAGNE/blob/main/docs/CHANGELOG.md"
champagne = "."

[tool.setuptools.package-data]
"*" = ["CITATION.cff", "LICENSE", "VERSION", "main.nf", "nextflow.config", "assets/**", "bin/**", "conf/**", "modules/**", "subworkflows/**", "tests/**"]
"*" = ["CITATION.cff", "LICENSE", "VERSION", "main.nf", "nextflow.config", "assets/**", "bin/**", "conf/**", "lib/**", "modules/**", "subworkflows/**", "tests/**"]

[tool.setuptools.dynamic]
version = {file = "VERSION"}
Expand Down

0 comments on commit 8302666

Please sign in to comment.