Skip to content

Commit 244d76e

Browse files
Add short option aliases to sinteractive
-l/-a alias --list/--attach, -j/--threads aliases --cpus-per-task, and -m aliases --mem. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 84e9105 commit 244d76e

2 files changed

Lines changed: 29 additions & 15 deletions

File tree

docs/sinteractive.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ sinteractive [OPTIONS] [SBATCH_ARGS...]
4141
| `--node NODE` | Request a specific compute node | any available |
4242
| `--partition PART` | SLURM partition | `interactive` |
4343
| `--time TIME` | Wall time limit | `08:00:00` |
44-
| `--cpus-per-task N` | Number of CPUs | `2` |
45-
| `--mem SIZE` | Memory | `8G` |
46-
| `--attach JOBID` | Reattach to a running session | |
47-
| `--list` | List running sinteractive sessions | |
44+
| `-j`, `--threads N` | Number of CPUs (alias for `--cpus-per-task`) | `2` |
45+
| `-m`, `--mem SIZE` | Memory | `8G` |
46+
| `-a`, `--attach JOBID` | Reattach to a running session | |
47+
| `-l`, `--list` | List running sinteractive sessions | |
4848
| `-h`, `--help` | Show help message | |
4949

5050
All other arguments are passed directly to `sbatch`, so you can use any `sbatch` option.

scripts/sinteractive

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ Usage: sinteractive [OPTIONS] [-- SBATCH_ARGS...]
6565
Start an interactive tmux session on a compute node via Slurm.
6666
6767
Options:
68-
-n, --name NAME Tag the session with a name for easy reattach
69-
(allowed: letters, digits, '.', '_', '-')
70-
--node NODE Request a specific compute node (e.g., compute01)
71-
--partition PART Slurm partition (default: interactive)
72-
--time TIME Wall time limit (default: 1 day)
73-
Supports shorthand: 8h, 30m, 2d, 1d12h, 1h30m
74-
--attach TARGET Reattach to a running session by JOBID or NAME
75-
--list List running sinteractive sessions (with NAME and CWD)
76-
-h, --help Show this help message
68+
-n, --name NAME Tag the session with a name for easy reattach
69+
(allowed: letters, digits, '.', '_', '-')
70+
--node NODE Request a specific compute node (e.g., compute01)
71+
--partition PART Slurm partition (default: interactive)
72+
--time TIME Wall time limit (default: 1 day)
73+
Supports shorthand: 8h, 30m, 2d, 1d12h, 1h30m
74+
-j, --threads N Number of CPUs (alias for --cpus-per-task)
75+
-m SIZE Memory (alias for --mem, e.g., 16G)
76+
-a, --attach TARGET Reattach to a running session by JOBID or NAME
77+
-l, --list List running sinteractive sessions (with NAME and CWD)
78+
-h, --help Show this help message
7779
7880
Note: -n is consumed by sinteractive as --name. Use --ntasks=N to set
7981
sbatch ntasks instead of -n.
@@ -130,10 +132,10 @@ function main {
130132
-h | --help)
131133
usage
132134
;;
133-
--list)
135+
-l | --list)
134136
list_sessions
135137
;;
136-
--attach)
138+
-a | --attach)
137139
reattach_target="$2"
138140
shift 2
139141
;;
@@ -177,6 +179,18 @@ function main {
177179
args+=(--partition="${1#--partition=}")
178180
shift
179181
;;
182+
-j | --threads)
183+
args+=(--cpus-per-task="$2")
184+
shift 2
185+
;;
186+
--threads=*)
187+
args+=(--cpus-per-task="${1#--threads=}")
188+
shift
189+
;;
190+
-m)
191+
args+=(--mem="$2")
192+
shift 2
193+
;;
180194
*)
181195
args+=("$1")
182196
shift

0 commit comments

Comments
 (0)