-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ or as a bsub comment: | |
|
||
If you submit an array job with this post-exec script, you'll only be notified once every job in the array has finished. | ||
|
||
For more suggestions, see the [`examples` directory](./examples). | ||
|
||
## Preemptively Answered Questions | ||
|
||
- **I don't use bsub, I use Nextflow** – Nextflow has built-in support for sending notifications when jobs finish. For example: `nextflow run -N [email protected]` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
#BSUB -Ep /software/cellgen/cellgeni/etc/notify-slack.sh | ||
|
||
# submit me with e.g.: bsub -o /dev/null < bsub.sh | ||
|
||
echo "hello, $USER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
// This block is the interesting part - copy it into your own script to use Farmer with Nextflow. | ||
workflow.onComplete { | ||
// Modify these variables to control the notification you receive. | ||
def user = workflow.userName | ||
def label = "Nextflow" | ||
def payload = [ | ||
"job name: " + workflow.runName, | ||
"launch dir: " + workflow.launchDir, | ||
"script name: " + workflow.scriptName, | ||
"started: " + workflow.start, | ||
"completed: " + workflow.complete, | ||
"exit status: " + workflow.exitStatus, | ||
workflow.errorMessage ? "error message: " + workflow.errorMessage : null, | ||
].minus(null).join("\n") | ||
// Leave this code as-is. | ||
URL url = new URL("http://farm22-cgi-01.internal.sanger.ac.uk:8234/job-complete"); | ||
HttpURLConnection conn = (HttpURLConnection)url.openConnection(); | ||
conn.setRequestMethod("POST"); | ||
conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); | ||
conn.setDoOutput(true); | ||
conn.connect(); | ||
OutputStream os = conn.getOutputStream(); | ||
String json = groovy.json.JsonOutput.toJson([job_id: null, array_index: null, user_override: user, label: label, payload: payload]); | ||
os.write(json.getBytes("UTF-8")); | ||
os.close(); | ||
conn.getResponseCode() | ||
conn.disconnect(); | ||
} | ||
|
||
// The rest is just a very simple example workflow. | ||
process sayHello { | ||
output: | ||
stdout | ||
|
||
script: | ||
""" | ||
echo 'Hello World!' | ||
""" | ||
} | ||
workflow { | ||
sayHello() | ||
} |