File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,14 @@ class BatchSpawnerBase(Spawner):
115115 help = "Other options to include into job submission script"
116116 ).tag (config = True )
117117
118+ req_prologue = Unicode ('' , \
119+ help = "Scipt to run before single user server starts."
120+ ).tag (config = True )
121+
122+ req_epilogue = Unicode ('' , \
123+ help = "Scipt to run after single user server end."
124+ ).tag (config = True )
125+
118126 req_username = Unicode ()
119127 @default ('req_username' )
120128 def _req_username_default (self ):
@@ -504,8 +512,12 @@ class SlurmSpawner(UserEnvMixin,BatchSpawnerRegexStates):
504512{% endif %}{% if nprocs %}#SBATCH --cpus-per-task={{nprocs}}
505513{% endif %}{% if options %}#SBATCH {{options}}{% endif %}
506514
515+ trap 'echo SIGTERM received' TERM
516+ {{prologue}}
507517which jupyterhub-singleuser
508- {{cmd}}
518+ srun {{cmd}}
519+ echo "jupyterhub-singleuser ended gracefully"
520+ {{epilogue}}
509521""" ).tag (config = True )
510522 # outputs line like "Submitted batch job 209"
511523 batch_submit_cmd = Unicode ('sudo -E -u {username} sbatch --parsable' ).tag (config = True )
You can’t perform that action at this time.
0 commit comments