playmolecule.devutils module#

playmolecule.devutils.app_arg_parser(description)#
playmolecule.devutils.app_arg_parser2(description)#
playmolecule.devutils.app_wrapper(args, parser, func)#
playmolecule.devutils.app_wrapper2(func, cli_arg_str)#
playmolecule.devutils.basenameInputs(parser, args, prefix='.')#

Returns the basename of the value for the file arguments :param parser: The argparse parser :type parser: argparse.ArgumentParser :param args: The dictionary of the arguments to inspect :type args: dict :param prefix: The path prefix to apply to the basename :type prefix: str

Returns

args – The dictionary of the arguments with the basename value (for files)

Return type

dict

playmolecule.devutils.getJobId(configpath)#

Returns the job id stored in the config file

Parameters

configpath (str) – The file path for the config file

Returns

jobid – The id of the job

Return type

str

playmolecule.devutils.pmtryexcept(arg1, arg2, arg3)#

The decorator that handles the try/except by redirecting the sys.stderr and sys.stdout to a log file. Two boolean arguments can trigger the usage of the log file: arg1 refers to standalone mode; arg2 refers to debug mode. For writing to the log file the arg1 needs to be False or the arg2 needs to be True.

playmolecule.devutils.pmws_wrapper(token, execid, pythonexe)#
playmolecule.devutils.setAsCompleted(outdir)#

Writes the sentinel for the complete job.

Parameters

outdir (str) – The location where to write the sentinel file

playmolecule.devutils.setAsError(outdir)#

Writes the sentinel for the error job.

Parameters

outdir (str) – The location where to write the sentinel file

playmolecule.devutils.setAsSleep(outdir)#

Writes the sentinel for the complete job.

Parameters

outdir (str) – The location where to write the sentinel file

playmolecule.devutils.tarFolder(folder, outtar=None, arcname='')#
playmolecule.devutils.unzipit(z, tmpdir='./tmp', overwrite=False, outdir=None)#

Returns a list with the files in the zip file (when a zip). In alternative, a list with the passed file/folder

z: str

The path file

Returns

inps – A list of the file in zip or the file/folder as unique item list

Return type

list

playmolecule.devutils.writeInputsOptionsLog(path, parser, varset, debug=False)#

Writes a log file, in yml format file, reporting all the options used for the current simulations. :param parser: The argparse parser :type parser: argparse.ArgumentParser :param path: The folder destination where to write the log :type path: str :param varset: The namespace that contains all the options used :type varset: Namespace :param debug: Set as True if you want to write the debug value :type debug: bool

playmolecule.devutils.writeInputsOptionsLog2(path, params)#

Writes a log file, in yml format file, reporting all the options used for the current simulations.

Parameters
  • path (str) – The folder destination where to write the log

  • params (dict) – The dict that contains all the options used

playmolecule.devutils.writeSentinel(fname, outfolder, message=None)#

Writes a sentinel file. A message can be written in the file

Parameters
  • fname (str) – The sentinel file name

  • outfolder (str) – The location where to write the sentinel file

  • message (str) – The text to write in the sentinel file

playmolecule.devutils.zipdir(path, ziph)#

Adds all the tree files of the folder passed into the zip file :param path: The path to add to the zip file :type path: str :param ziph: The zipfile object :type ziph: zipfile.ZipFile

playmolecule.devutils.zipit(dir_list, zip_name)#

Creates the zip file with all the files and folder passed

Parameters
  • dir_list (list) – The list of files and folders to zip

  • zip_name (str) – The name of the zipfile