From c432ef8aaf51f2abd0d5d6630a049788a6d6d38c Mon Sep 17 00:00:00 2001 From: cal Date: Mon, 18 Sep 2023 16:05:03 +1200 Subject: [PATCH] Added a note about killing tasks. --- _config.yml | 11 +++++++++-- _episodes/05-scheduler.md | 15 ++++++++------- _includes/example_scripts/example-job.sh | 5 +++++ 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 _includes/example_scripts/example-job.sh diff --git a/_config.yml b/_config.yml index 68223051..ccb58866 100644 --- a/_config.yml +++ b/_config.yml @@ -47,11 +47,18 @@ sched: efficiency: "nn_seff" projectcode: "nesi99991" +# For 'R' +example: + lang: "R" + shell: "Rscript" + script: "array_sum.r" + module: "R/4.1.0-gimkl-2020a" + episode_order: - 01-cluster - 02-filedir - 03-break1 - - 04-moduless + - 04-modules - 05-scheduler - 06-lunch - 07-resources @@ -95,7 +102,7 @@ working_dir: # Start time in minutes (0 to be clock-independent, 540 to show a start at 09:00 am). # 600 is 10am -start_time: 780 +start_time: 600 # Start time for people wanting to skip bash content hpc_start_time: 780 # Lesson to start at. diff --git a/_episodes/05-scheduler.md b/_episodes/05-scheduler.md index ba2b4126..f37c3865 100644 --- a/_episodes/05-scheduler.md +++ b/_episodes/05-scheduler.md @@ -63,11 +63,7 @@ Lets try this now, create and open a new file in your current directory called ` ``` -{{ site.remote.bash_shebang }} - -module load R/4.1.0-gimkl-2020a -Rscript array_sum.r -echo "Done!" +{% include example_scripts/example-job.sh %} ``` {: .language-bash} @@ -77,7 +73,6 @@ echo "Done!" > {: .callout} - We can now run this script using ``` {{ site.remote.prompt }} bash example-job.sh @@ -100,6 +95,13 @@ Done! You will get the output printed to your terminal as if you had just run those commands one after another. +> ## Cancelling Commands +> +> You can kill a currently running task by pressing the keys ctrl + c. +> If you just want your terminal back, but want the task to continue running you can 'background' it by pressing ctrl + v. +> Note, a backgrounded task is still attached to your terminal session, and will be killed when you close the terminal (if you need to keep running a task after you log out, have a look at [tmux](https://support.nesi.org.nz/hc/en-gb/articles/4563511601679-tmux-Reference-sheet)). +{: .callout} + ## Scheduled Batch Job Up until now the scheduler has not been involved, our scripts were run directly on the login node (or Jupyter node). @@ -188,7 +190,6 @@ status, we check the queue using the command {% include {{ site.snippets }}/scheduler/basic-job-status.snip %} - If we were too slow, and the job has already finished (and therefore not in the queue) there is another command we can use `{{ site.sched.hist }}` (**s**lurm **acc**oun**t**). By default `{{ site.sched.hist }}` only includes jobs submitted by you, so no need to include additional commands at this point. ``` diff --git a/_includes/example_scripts/example-job.sh b/_includes/example_scripts/example-job.sh new file mode 100644 index 00000000..f61dba3b --- /dev/null +++ b/_includes/example_scripts/example-job.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +module load R/4.3.1-gimkl-2022a +Rscript array_sum.r +echo "Done!" \ No newline at end of file