Skip to content

Commit d5a193f

Browse files
committed
SPANK plugin sessions tests
1 parent ea7865c commit d5a193f

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ jobs:
213213
run: |
214214
docker exec slurm-plugin-head bash -c 'cd Spindle-build/testsuite && salloc -n${workers} -N${workers} ./runTests ${workers}'
215215
216+
- name: Run spindle-slurm-plugin-ubuntu session testsuite
217+
id: slurm-ubuntu-testsuite
218+
run: |
219+
docker exec slurm-plugin-head bash -c 'cd Spindle-build/testsuite && salloc -n${workers} -N${workers} --spindle-session ./runTests ${workers}'
220+
216221
- name: Bring spindle-slurm-plugin-ubuntu down
217222
id: slurm-ubuntu-down
218223
if: ${{ always() }}

src/slurm_plugin/plugin_utils.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ int srunAllNodes(unsigned int num_nodes, const char *command)
4848
// In child
4949
char n[12];
5050
snprintf(n, sizeof(n), "%u", num_nodes);
51-
fprintf(stderr, "Going to srun on %s nodes\n", n);
5251
execlp("srun",
5352
"srun",
5453
"--nodes", n,

src/slurm_plugin/slurm_plugin.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,15 @@ static int handleStart(void *params, char **output_str)
562562
return 0;
563563
}
564564

565-
err = get_stepid(spank, &stepid);
566-
if (err != ESPANK_SUCCESS) {
567-
slurm_error("ERROR: Spindle plugin error. Could not get step id.");
568-
return -1;
569-
}
570-
571565
// Only initialize a session once
572-
if (use_session && (args.opts & OPT_RSHLAUNCH) && (stepid != 0))
566+
if (use_session && (args.opts & OPT_RSHLAUNCH) && (stepid != 0)) {
567+
err = get_stepid(spank, &stepid);
568+
if (err != ESPANK_SUCCESS) {
569+
slurm_error("ERROR: Spindle plugin error. Could not get step id.");
570+
return -1;
571+
}
573572
return 0;
573+
}
574574

575575
result = launch_spindle(spank, &args);
576576
if (result == -1) {
@@ -633,6 +633,7 @@ int slurm_spank_task_exit(spank_t spank, int site_argc, char *site_argv[])
633633
return 0;
634634
}
635635

636+
636637
static spank_err_t get_stepid(spank_t spank, uint32_t *stepid)
637638
{
638639
char *slurm_step_id_s;

testsuite/runTests_template

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ export TEST_RM="TEST_RESOURCE_MANAGER"
66
export GLOBAL_RESULT=0
77
CHECK_RETCODE() { if [[ $? != 0 ]]; then export GLOBAL_RESULT=-1; fi }
88

9+
# For slurm-plugin, whether we use a session is determined by the allocation we run in.
10+
# Run only the non-session tests if this allocation doesn't use a session.
11+
# Run only the session tests if this allocation uses a session.
12+
SKIP_NONSESSION=false
13+
if test "x$TEST_RM" == "xslurm-plugin" && test "x$SPANK_SPINDLE_USE_SESSION" != "x"; then
14+
SKIP_NONSESSION=true
15+
fi
16+
17+
if test "x$SKIP_NONSESSION" != "xtrue"; then
18+
919
./run_driver --dependency --push
1020
CHECK_RETCODE
1121
./run_driver --dlopen --push
@@ -129,7 +139,17 @@ CHECK_RETCODE
129139
./run_driver --spindleapi --preload
130140
CHECK_RETCODE
131141

132-
if test "x$TEST_RM" != "xserial"; then
142+
fi # SKIP_NONSESSION
143+
144+
SKIP_SESSION=false
145+
if test "x$TEST_RM" == "xserial"; then
146+
SKIP_SESSION=true
147+
fi
148+
if test "x$TEST_RM" == "xslurm-plugin" && test "x$SPANK_SPINDLE_USE_SESSION" == "x"; then
149+
SKIP_SESSION=true
150+
fi
151+
152+
if test "x$SKIP_SESSION" != "xtrue"; then
133153
export SESSION_ID=`./run_driver --start-session`
134154
./run_driver --dependency --session
135155
CHECK_RETCODE

testsuite/run_driver_template

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export SPINDLE=SPINDLE_EXEC
1111
export PATH=$PATH:.
1212

1313
if [ $1 == --start-session ] ; then
14+
# With SPANK plugin, sessions are started by argument to salloc/sbatch instead
15+
if [ "x$TEST_RM" == "xslurm-plugin" ] ; then
16+
exit 0
17+
fi
1418
export SPINDLEID=`$SPINDLE --start-session --level=high`
1519
if [ x$SPINDLEID == x ]; then
1620
echo ANONYMOUS_SESSION
@@ -20,6 +24,9 @@ if [ $1 == --start-session ] ; then
2024
exit 0
2125
fi
2226
if [ $1 == --end-session ] ; then
27+
if [ "x$TEST_RM" == "xslurm-plugin" ] ; then
28+
exit 0
29+
fi
2330
if [ x$2 == xANONYMOUS_SESSION ] ; then
2431
$SPINDLE --end-session
2532
else
@@ -59,11 +66,14 @@ export SPINDLE_OPTS="--numa"
5966
fi
6067

6168
if [ $2 == --session ] ; then
62-
if [ x$SESSION_ID == x ] ; then
63-
export SESSION_ID=`$SPINDLE --start-session`
64-
export STARTED_SPINDLE_SESSION=true
69+
# With SPANK plugin, we run in session if the allocation has a session
70+
if [ "x$TEST_RM" != "xslurm-plugin" ] ; then
71+
if [ x$SESSION_ID == x ] ; then
72+
export SESSION_ID=`$SPINDLE --start-session`
73+
export STARTED_SPINDLE_SESSION=true
74+
fi
75+
export SPINDLE_OPTS="--run-in-session $SESSION_ID"
6576
fi
66-
export SPINDLE_OPTS="--run-in-session $SESSION_ID"
6777
fi
6878

6979
export SPINDLE_BLUEGENE="BLUEGENE_TEST"

0 commit comments

Comments
 (0)