QuaLiKiz-Pythontools
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch Class Reference

A collection of QuaLiKiz Runs. More...

Inheritance diagram for qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, parent_dir, name, runlist, stdout=None, stderr=None)
 Initialize a batch. More...
 
def prepare (self, overwrite_batch=None, overwrite_runs=False, overwrite_batch_script=False)
 Prepare the batch and runs to be submitted This function writes necessary files and folders for the batch to run correctly. More...
 
def generate_input (self, dotprint=False, processes=1, conversion=None)
 Generate the input files for all runs. More...
 
def inputbinaries_exist (self)
 
def from_dir_recursive (cls, searchdir)
 Reconstruct batch from directory tree Walks from the given path until it finds a file named QuaLiKizBatch.scriptname, and tries to reconstruct the batch from there. More...
 
def list_from_dir (cls, dir, scriptname=None, verbose=False, run_kwargs=None, batch_kwargs=None)
 
def from_dir (cls, dir, args, kwargs)
 
def from_subdirs (cls, batchdir, args, scriptname=None, verbose=False, run_kwargs=None, batch_kwargs=None)
 Reconstruct batch from a directory This function assumes that the name of the batch can be determined by the given batchdir. More...
 
def runlist_from_subdirs (cls, batchdir, verbose=False, kwargs)
 
def to_netcdf (self, mode='noglue', clean=True, processes=1, verbose=False, overwrite_runs=None, overwrite_batch=None, run_kwargs=None, gluedim=None, nofinal=False, loopy=False)
 Convert QuaLiKizBatch output to netcdf. More...
 
def clean (self)
 Remove all output. More...
 
def is_done (self)
 Check if job is done running. More...
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 

Public Attributes

 parent_dir
 
 name
 
 runlist
 
 stdout
 
 stderr
 

Static Public Attributes

string batchinfofile = 'batchinfo.json'
 The default name of batchinfo file. More...
 
string scriptname = 'qualikiz.batch'
 The default name of the sbatch scipt file. More...
 
string default_stderr = 'stderr.batch'
 Default name to write STDERR to. More...
 
string default_stdout = 'stdout.batch'
 Default name to write STDOUT to. More...
 
 run_class = QuaLiKizRun
 The class of the underlying QuaLiKiz run. More...
 

Detailed Description

A collection of QuaLiKiz Runs.

This class is used to define a collection of QuaLiKiz Runs. This is more or less equivalent with a batch script, but with path awareness and some extra smarts built-in.

Constructor & Destructor Documentation

◆ __init__()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.__init__ (   self,
  parent_dir,
  name,
  runlist,
  stdout = None,
  stderr = None 
)

Initialize a batch.

Parameters
parent_dirParent directory of the batch directory.
nameName of the batch. This will also be the folder name
runlistA list of QuaLiKizRuns contained in this batch
stdoutFile to write stdout to. By default 'stdout.batch'
stderrFile to write stderr to. By default 'stderr.batch'

Member Function Documentation

◆ __eq__()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.__eq__ (   self,
  other 
)

◆ __ne__()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.__ne__ (   self,
  other 
)

◆ clean()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.clean (   self)

Remove all output.

◆ from_dir()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.from_dir (   cls,
  dir,
  args,
  kwargs 
)

◆ from_dir_recursive()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.from_dir_recursive (   cls,
  searchdir 
)

Reconstruct batch from directory tree Walks from the given path until it finds a file named QuaLiKizBatch.scriptname, and tries to reconstruct the batch from there.

Parameters
searchdirThe path to search
Returns
batchlist A list of batches found

◆ from_subdirs()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.from_subdirs (   cls,
  batchdir,
  args,
  scriptname = None,
  verbose = False,
  run_kwargs = None,
  batch_kwargs = None 
)

Reconstruct batch from a directory This function assumes that the name of the batch can be determined by the given batchdir.

If the batch was created with the functions contained in this module, it should always be succesfully re-contructed.

Parameters
batchdirThe top directory of the batch
scriptnamename of the script to search for. Defaults to qualikiz.batch.
Returns
qualikizbatch The reconstructed batch

◆ generate_input()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.generate_input (   self,
  dotprint = False,
  processes = 1,
  conversion = None 
)

Generate the input files for all runs.

Parameters
dotprintPrint a dot after each generation. Used for debugging.
processesAmount of processes used to generate. Defaults to 1. Set this to 'max' to autodetect.
conversionFunction will be called as conversion(input_dir). Can be used to convert input files to older version.

◆ inputbinaries_exist()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.inputbinaries_exist (   self)

◆ is_done()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.is_done (   self)

Check if job is done running.

Returns
True if job is done

◆ list_from_dir()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.list_from_dir (   cls,
  dir,
  scriptname = None,
  verbose = False,
  run_kwargs = None,
  batch_kwargs = None 
)

◆ prepare()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.prepare (   self,
  overwrite_batch = None,
  overwrite_runs = False,
  overwrite_batch_script = False 
)

Prepare the batch and runs to be submitted This function writes necessary files and folders for the batch to run correctly.

Note that this does not generate the input files, as that might take a while. You can generate those with the generate_input function.

Parameters
overwrite_batchFlag to overwrite the batch folder if it already exists. Prompts the user by default.
overwrite_runsFlag to overwrite the runs folders if they already exist. False by default.

◆ runlist_from_subdirs()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.runlist_from_subdirs (   cls,
  batchdir,
  verbose = False,
  kwargs 
)

◆ to_netcdf()

def qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.to_netcdf (   self,
  mode = 'noglue',
  clean = True,
  processes = 1,
  verbose = False,
  overwrite_runs = None,
  overwrite_batch = None,
  run_kwargs = None,
  gluedim = None,
  nofinal = False,
  loopy = False 
)

Convert QuaLiKizBatch output to netcdf.

This function converts the output contained in the output and debug folders to netcdf. Optionally the datasets are glued together afterwards by setting the 'mode' keyword argument. Compresses the dataset by default.

Parameters
modeWhat to do after netcdfizing runs. Set 'glue' to glue datasets together [Default: 'noglue']
cleanRemove netcdf files generated by QuaLiKizRun.to_netcdf when done. [Default: True]
processesAmount of processes used to generate. Set this to 'max' to autodetect. [Default: 1]
verboseVerbosity of the function. Will be passed to children [Default: False]
overwrite_runsOverwrite pre-existing Run netCDFs [Default: prompt user]
overwrite_batchOverwrite pre-existing Batch netCDFs [Default: prompt user]
run_kwargsKwargs to pass to run_to_netcdf [Default: None]
gluedimDimension added to Run netCDFs to act as dimension to be glued
overNone]
nofinalDo not generate a Batch netCDF, just the Run NetCDFs
loopyConcatenate Run netCDFs in a loop instead of a single
operationFalse]

Member Data Documentation

◆ batchinfofile

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.batchinfofile = 'batchinfo.json'
static

The default name of batchinfo file.

Used to store

◆ default_stderr

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.default_stderr = 'stderr.batch'
static

Default name to write STDERR to.

◆ default_stdout

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.default_stdout = 'stdout.batch'
static

Default name to write STDOUT to.

◆ name

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.name

◆ parent_dir

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.parent_dir

◆ run_class

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.run_class = QuaLiKizRun
static

The class of the underlying QuaLiKiz run.

◆ runlist

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.runlist

◆ scriptname

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.scriptname = 'qualikiz.batch'
static

The default name of the sbatch scipt file.

◆ stderr

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.stderr

◆ stdout

qualikiz_tools.qualikiz_io.qualikizrun.QuaLiKizBatch.stdout

The documentation for this class was generated from the following file: