Custom commands
For easeness of use, you can create custom commands to automatize some actions.
For example, you can define a custom command drain_node
to drain a Slurm node from all jobs and put it to idle so you don't have to remember the exact command each time.
How to add a custom command¶
To add a custom script, you have to create a new file in ~/bin
.
Note that this location is not shared between nodes and is not shared between users.
Once you create a file here and set the right permissions, the command will be immediately available.
This is a step-by-step guide to create a custom command:
-
Create a folder that will contain all your custom scripts. It can be located everywhere, but for easeness of use we will create it in our home directory:
-
Add this folder to your
PATH
by adding this line at the end of your~/.bashrc
(e.g. usingnano ~/.bashrc
):After that, either run
source ~/.bashrc
or reload your shell to apply changes. -
Create the new script inside your newly created
~/bin
. Remember to prepend#!/bin/bash
to the file to tell the system to run it using the shell. The following script, calledcustom_command
, will simply print a string: -
Set the new permissions accordingly. For easiness, you can set them for the entire folder:
Now you can run custom_command
from your shell to print the string.
List of implemented admin custom commands¶
Connections¶
connect_to_node
¶
Connect to a node through ssh
.
Requires a node ID as a parameter (e.g. 102
).
connect_to_submitter
¶
Connect to the submitter node through ssh
.
connect_to_controller
¶
Connect to the controller node through ssh
.
Containers¶
docker_kill_old
¶
Kill all containers running for more than 30 minutes.
This command is automatically executed every minute using crontab
.
Slurm¶
drain_node
¶
Drains a Slurm node from all jobs and put it idle.