petitRADTRANS.slurm_runs.sbatch
===============================

.. py:module:: petitRADTRANS.slurm_runs.sbatch

.. autoapi-nested-parse::

   Make slurm sbatch files.



Functions
---------

.. autoapisummary::

   petitRADTRANS.slurm_runs.sbatch.get_line_separator
   petitRADTRANS.slurm_runs.sbatch.make_srun_script_from_template


Module Contents
---------------

.. py:function:: get_line_separator(line)

   Find the line separator of a line.
      Assume that the line separator is at the end of the line.
      Possible line separators are 
   (CR), 
   (LF) or 
   (CRLF).

      Args:
          line: any string ending with a line separator

      Returns:
          linesep: the line separator as a string, or None if no valid line separator was found
      


.. py:function:: make_srun_script_from_template(filename, template_filename, job_name='petitRADTRANS_job', nodes=1, tasks_per_node=1, cpus_per_task=1, time='0-00:01:00', srun_lines=None)

   Make a new srun script file from a template file, updating some options.
   The template script has to be a working slurm script. All the #SBATCH option lines must be at the beginning of the
   template script.

   Args:
       filename: name of the new file to generate
       template_filename: any working sbatch script
       job_name: name of the slurm job allocation
       nodes: number of nodes to allocate to the slurm job
       tasks_per_node: number of tasks to be invoked on each node, equivalent to the number of processes for MPI
       cpus_per_task: number of processors per task, relevant when launching application with a required number of CPUs
       time: (days-hours:minutes:seconds) total job run time limit
       srun_lines: if None, do nothing; otherwise, if a srun line is present in the template, modify it, else add the
                   lines at the end of the script. Must be a list of strings ending with a line separator.


