class_docstr: Slurm job executor
  This class is used to hold the parameters to run a job on slurm.
  In practice, it will create a batch file in the specified directory for each job,
  and pickle the task function and parameters. At completion, the job will also pickle
  the output. Logs are also dumped in the same directory.
  
  Parameters
  ----------
  folder: Path/str
      folder for storing job submission/output and logs.
  max_num_timeout: int
      Maximum number of time the job can be requeued after timeout (if
      the instance is derived from helpers.Checkpointable)
  python: Optional[str]
      Command to launch python. This allow to use singularity for example.
      Caller is responsible to provide a valid shell command here.
      By default reuse the current python executable
  
  Note
  ----
  - be aware that the log/output folder will be full of logs and pickled objects very fast,
    it may need cleaning.
  - the folder needs to point to a directory shared through the cluster. This is typically
    not the case for your tmp! If you try to use it, slurm will fail silently (since it
    will not even be able to log stderr.
  - use update_parameters to specify custom parameters (n_gpus etc...). If you
    input erroneous parameters, an error will print all parameters available for you.
class_docstr_tok: ["Slurm","job","executor","This","class","is","used","to","hold","the","parameters","to","run","a","job","on","slurm",".","In","practice",",","it","will","create","a","batch","file","in","the","specified","directory","for","each","job",",","and","pickle","the","task","function","and","parameters",".","At","completion",",","the","job","will","also","pickle","the","output",".","Logs","are","also","dumped","in","the","same","directory",".","Parameters","--","--","--","--","--","folder",":","Path\/str","folder","for","storing","job","submission\/output","and","logs",".","max_num_timeout",":","int","Maximum","number","of","time","the","job","can","be","requeued","after","timeout","(","if","the","instance","is","derived","from","helpers.Checkpointable",")","python",":","Optional","[","str","]","Command","to","launch","python",".","This","allow","to","use","singularity","for","example",".","Caller","is","responsible","to","provide","a","valid","shell","command","here",".","By","default","reuse","the","current","python","executable","Note","--","--","-","be","aware","that","the","log\/output","folder","will","be","full","of","logs","and","pickled","objects","very","fast",",","it","may","need","cleaning",".","-","the","folder","needs","to","point","to","a","directory","shared","through","the","cluster",".","This","is","typically","not","the","case","for","your","tmp","!","If","you","try","to","use","it",",","slurm","will","fail","silently","(","since","it","will","not","even","be","able","to","log","stderr",".","-","use","update_parameters","to","specify","custom","parameters","(","n_gpus","etc","...",")",".","If","you","input","erroneous","parameters",",","an","error","will","print","all","parameters","available","for","you","."]
docstr: Returns the job ID from the output of sbatch string
docstr_tok: ["Returns","the","job","ID","from","the","output","of","sbatch","string"]
code: def _get_job_id_from_submission_command(
      string: tp.Union[bytes, str]
  ) -> str:
      """Returns the job ID from the output of sbatch string"""
      if not isinstance(string, str):
          string = string.decode()
      output = re.search(r"job (?P<id>[0-9]+)", string)
      if output is None:
          raise utils.FailedSubmissionError(
              f'Could not make sense of sbatch output "{string}"\n'
              "Job instance will not be able to fetch status\n"
              "(you may however set the job job_id manually if needed)"
          )
      return output.group("id")
  
imports: import functools
  import inspect
  import os
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import typing
  import uuid
  import warnings
  from pathlib import Path
  from ..core import core, job_environment, logger, utils
label_desc: Use image node_id 11 for calling the SlurmExecutor obj's underlying member method code with example usage: obj._get_job_id_from_submission_command(string) and returns: output