@@ -481,6 +481,41 @@ async def test_slurm(db, event_loop):
481
481
re .compile (r"^\#SBATCH \s+ some_option_asdf" , re .X | re .M ),
482
482
re .compile (r"^\#SBATCH \s+ --reservation=RES123" , re .X | re .M ),
483
483
re .compile (r"^\#SBATCH \s+ --gres=GRES123" , re .X | re .M ),
484
+ re .compile (
485
+ r"^\#SBATCH \s+ --output= .+ /jupyterhub_slurmspawner_%j.log" , re .X | re .M
486
+ ),
487
+ ]
488
+ from .. import SlurmSpawner
489
+
490
+ run_spawner_script (
491
+ db ,
492
+ event_loop ,
493
+ SlurmSpawner ,
494
+ normal_slurm_script ,
495
+ batch_script_re_list = batch_script_re_list ,
496
+ spawner_kwargs = spawner_kwargs ,
497
+ )
498
+
499
+
500
+ @pytest .mark .parametrize (
501
+ "req_output,expected_file_pattern" ,
502
+ [
503
+ ("/dev/null" , "/dev/null" ),
504
+ ("slurm-%j.out" , "{homedir}/slurm-%j.out" ),
505
+ ],
506
+ )
507
+ def test_slurm_req_output (db , io_loop , req_output , expected_file_pattern ):
508
+ homedir = "/users/jhub_users"
509
+ spawner_kwargs = {
510
+ "req_output" : req_output ,
511
+ "req_homedir" : homedir ,
512
+ }
513
+
514
+ batch_script_re_list = [
515
+ re .compile (
516
+ r"^\#SBATCH \s+ --output=" + expected_file_pattern .format (homedir = homedir ),
517
+ re .X | re .M ,
518
+ ),
484
519
]
485
520
from .. import SlurmSpawner
486
521
0 commit comments