class_docstr: A :class:`Job` subclass to schedule tasks on Slurm.
  
  Runs an 'sbatch' command in the shell with the script.
  
  Attributes:
      output_file: (optional) :obj:`str`. Path to the file where the executed
          script will dump the result file. If none is provided, a temporary
          file will be created.
code: def _create_slurm_script(self) -> List[str]:
      if not self.meta:
          raise ValueError(
              f"Cannot infer slurm job parameters. "
              f"Fill in meta dict in job {self.id}."
          )
      else:
          # Preamble, job name and output log filename definitions
          content_lines = [
              f"{self._SLURM_SCRIPT_PREAMBLE}\n",
              f"{self._SLURM_SCRIPT_LINE_PREFIX} "
              f"{self._SLURM_SCRIPT_JOB_NAME}=job_{self.id}\n",
              f"{self._SLURM_SCRIPT_LINE_PREFIX} "
              f"{self._SLURM_SCRIPT_OUT_NAME}=log_%j.txt\n",
          ]
          # Resources specification
          n_cpus = int(self.meta.get("resources", {}).get("cpu", 1))
          if n_cpus >= 1:
              content_lines.append(
                  f"{self._SLURM_SCRIPT_LINE_PREFIX} "
                  f"{self._SLURM_SCRIPT_RESOURCES_CPU}={n_cpus}\n"
              )
          gpus = str(self.meta.get("resources", {}).get("gpu", ""))
          if gpus:
              if gpus.isnumeric():
                  gpus = f"gpu:{gpus}"
              content_lines.append(
                  f"{self._SLURM_SCRIPT_LINE_PREFIX} "
                  f"{self._SLURM_SCRIPT_RESOURCES_GPU}={gpus}\n"
              )
          mem = str(self.meta.get("resources", {}).get("memory", ""))
          if mem:
              content_lines.append(
                  f"{self._SLURM_SCRIPT_LINE_PREFIX} "
                  f"{self._SLURM_SCRIPT_RESOURCES_MEM}={mem}\n"
              )
          limit_time = str(
              self.meta.get("resources", {}).get("time", "")
          )
          if limit_time:
              content_lines.append(
                  f"{self._SLURM_SCRIPT_LINE_PREFIX} "
                  f"{self._SLURM_SCRIPT_RESOURCES_TIME}={limit_time}\n"
              )
          # Task specification
          binary = self.meta.get("binary", "python")
          if isinstance(self.args, Tuple):
              # build positional arguments
              script_args = " ".join(
                  [*map(str, self.args), self.output_file]
              )
          else:
              # build named arguments
              script_args = " ".join(
                  [
                      *(
                          str(item)
                          for key_val in self.args.items()
                          for item in key_val
                      ),
                      "--output_file",
                      self.output_file,
                  ]
              )
          content_lines.append(f"{binary} {self.task} {script_args}")
      return content_lines
  
imports: import enum
  import importlib
  import os
  import pickle
  import re
  import subprocess
  import sys
  import tempfile
  import time
  from dataclasses import dataclass, field
  from functools import partial
  from typing import Any, Callable, Dict, List, Tuple, Union
label_desc: Use image node_id 4 for calling the SlurmJob obj's underlying member method code with example usage: obj._create_slurm_script() and returns: content_lines