1515 * remote execution via submission of templated scripts
1616 * job names instead of PIDs
1717"""
18+
1819import asyncio
1920import os
2021import pwd
@@ -574,8 +575,7 @@ def state_gethost(self):
574575
575576
576577class TorqueSpawner (BatchSpawnerRegexStates ):
577- batch_script = Unicode (
578- """#!/bin/sh
578+ batch_script = Unicode ("""#!/bin/sh
579579#PBS -q {queue}@{host}
580580#PBS -l walltime={runtime}
581581#PBS -l nodes=1:ppn={nprocs}
@@ -589,8 +589,7 @@ class TorqueSpawner(BatchSpawnerRegexStates):
589589{prologue}
590590{cmd}
591591{epilogue}
592- """
593- ).tag (config = True )
592+ """ ).tag (config = True )
594593
595594 # outputs job id string
596595 batch_submit_cmd = Unicode ("qsub" ).tag (config = True )
@@ -615,8 +614,7 @@ class MoabSpawner(TorqueSpawner):
615614
616615
617616class PBSSpawner (TorqueSpawner ):
618- batch_script = Unicode (
619- """#!/bin/sh
617+ batch_script = Unicode ("""#!/bin/sh
620618{% if queue or host %}#PBS -q {% if queue %}{{queue}}{% endif %}\
621619 {% if host %}@{{host}}{% endif %}{% endif %}
622620#PBS -l walltime={{runtime}}
@@ -632,8 +630,7 @@ class PBSSpawner(TorqueSpawner):
632630{{prologue}}
633631{{cmd}}
634632{{epilogue}}
635- """
636- ).tag (config = True )
633+ """ ).tag (config = True )
637634
638635 # outputs job data XML string
639636 batch_query_cmd = Unicode ("qstat -fx {job_id}" ).tag (config = True )
@@ -673,8 +670,7 @@ def get_env(self):
673670
674671
675672class SlurmSpawner (UserEnvMixin , BatchSpawnerRegexStates ):
676- batch_script = Unicode (
677- """#!/bin/bash
673+ batch_script = Unicode ("""#!/bin/bash
678674#SBATCH --output={{homedir}}/jupyterhub_slurmspawner_%j.log
679675#SBATCH --job-name=spawner-jupyterhub
680676#SBATCH --chdir={{homedir}}
@@ -695,8 +691,7 @@ class SlurmSpawner(UserEnvMixin, BatchSpawnerRegexStates):
695691{% if srun %}{{srun}} {% endif %}{{cmd}}
696692echo "jupyterhub-singleuser ended gracefully"
697693{{epilogue}}
698- """
699- ).tag (config = True )
694+ """ ).tag (config = True )
700695
701696 # all these req_foo traits will be available as substvars for templated strings
702697 req_cluster = Unicode (
@@ -771,8 +766,7 @@ def state_gethost(self):
771766
772767
773768class GridengineSpawner (BatchSpawnerBase ):
774- batch_script = Unicode (
775- """#!/bin/bash
769+ batch_script = Unicode ("""#!/bin/bash
776770#$ -j yes
777771#$ -N spawner-jupyterhub
778772#$ -o {homedir}/.jupyterhub.sge.out
@@ -785,8 +779,7 @@ class GridengineSpawner(BatchSpawnerBase):
785779{prologue}
786780{cmd}
787781{epilogue}
788- """
789- ).tag (config = True )
782+ """ ).tag (config = True )
790783
791784 # outputs job id string
792785 batch_submit_cmd = Unicode ("qsub" ).tag (config = True )
@@ -850,8 +843,7 @@ def get_env(self):
850843
851844
852845class CondorSpawner (UserEnvMixin , BatchSpawnerRegexStates ):
853- batch_script = Unicode (
854- """
846+ batch_script = Unicode ("""
855847Executable = /bin/sh
856848RequestMemory = {memory}
857849RequestCpus = {nprocs}
@@ -863,8 +855,7 @@ class CondorSpawner(UserEnvMixin, BatchSpawnerRegexStates):
863855GetEnv = True
864856{options}
865857Queue
866- """
867- ).tag (config = True )
858+ """ ).tag (config = True )
868859
869860 # outputs job id string
870861 batch_submit_cmd = Unicode ("condor_submit" ).tag (config = True )
@@ -894,8 +885,7 @@ def cmd_formatted_for_batch(self):
894885class LsfSpawner (BatchSpawnerBase ):
895886 """A Spawner that uses IBM's Platform Load Sharing Facility (LSF) to launch notebooks."""
896887
897- batch_script = Unicode (
898- """#!/bin/sh
888+ batch_script = Unicode ("""#!/bin/sh
899889#BSUB -R "select[type==any]" # Allow spawning on non-uniform hardware
900890#BSUB -R "span[hosts=1]" # Only spawn job on one server
901891#BSUB -q {queue}
@@ -908,8 +898,7 @@ class LsfSpawner(BatchSpawnerBase):
908898{prologue}
909899{cmd}
910900{epilogue}
911- """
912- ).tag (config = True )
901+ """ ).tag (config = True )
913902
914903 batch_submit_cmd = Unicode ("bsub" ).tag (config = True )
915904 batch_query_cmd = Unicode ('bjobs -a -noheader -o "STAT EXEC_HOST" {job_id}' ).tag (
0 commit comments