carputils
Doxygen code documentation for the python framework controlling openCARP
Public Member Functions | Properties | List of all members
carputils.bundle.bundle.BundleModule Class Reference

Class for global bundle object. More...

Public Member Functions

def __init__ (self)
 
def create_bundle_folder (self)
 Creates the bundle folder. More...
 
def prepopulate_bundle_folder (self)
 Initialize clean bundle folder by copying content of 'Mesh' and 'external' folders, as well as files and folders listed in '.bundleinclude' file. More...
 
def cleanup_bundle_folder (self)
 " Clean up an existing bundle before updating it: More...
 
def finalize_bundle (self, job_id=None)
 Writes the protocol script in the bundle folder, modifies parameter files containing unresolved paths and creates a zip archive of the bundle if necessary. More...
 
def modify_par_file (self, par_file)
 Modify parameter file in order for paths to be consistent in the bundle and put the input files given as parameters in the bundle. More...
 
def resolve_parfile_path (self, path, current_param=None, mesh=False)
 Put the file targeted by 'path' into the bundle if necessary and returns the path to this file in the bundle. More...
 
def create_metadata_file (self)
 Creates and writes the codemeta.json file related to the current experiment in the bundle. More...
 
def add_queued_simfiles (self)
 Adds simfiles queued in self._simfiles_queue (with _store_simfile function) in the bundle and consequently modifies protocol script. More...
 
def check_found_simfiles (self)
 Checks if any external files could be missing in the bundle for the experiment to run properly and raises adequate warnings. More...
 

Properties

 exp_file = property
 
 exp_filename = property
 
 exp_dir = property
 
 meshdir_name = property
 
 externaldir_name = property
 
 exp_name = property
 The name of the experiment, defined in the command line as an argument for the –bundle option. More...
 
 bundle_foldername = property
 
 bundle_dir = property
 
 protocol_script = property
 
 OCparams = property
 
 file_OCparams = property
 

Detailed Description

Class for global bundle object.

When the bundle module is loaded, it is replaced by an instance of this class. Contains all useful data and functions for creating a self-contained bundle of the running experiment.

More information on how to create a bundle can be found in HOWTO_BUNDLE.md.

Constructor & Destructor Documentation

◆ __init__()

def carputils.bundle.bundle.BundleModule.__init__ (   self)

Member Function Documentation

◆ add_queued_simfiles()

def carputils.bundle.bundle.BundleModule.add_queued_simfiles (   self)

Adds simfiles queued in self._simfiles_queue (with _store_simfile function) in the bundle and consequently modifies protocol script.

◆ check_found_simfiles()

def carputils.bundle.bundle.BundleModule.check_found_simfiles (   self)

Checks if any external files could be missing in the bundle for the experiment to run properly and raises adequate warnings.

◆ cleanup_bundle_folder()

def carputils.bundle.bundle.BundleModule.cleanup_bundle_folder (   self)

" Clean up an existing bundle before updating it:

  • Keep Git, metadata and license files
  • Remove everything else

◆ create_bundle_folder()

def carputils.bundle.bundle.BundleModule.create_bundle_folder (   self)

Creates the bundle folder.

Returns
path to the bundle directory

◆ create_metadata_file()

def carputils.bundle.bundle.BundleModule.create_metadata_file (   self)

Creates and writes the codemeta.json file related to the current experiment in the bundle.

◆ finalize_bundle()

def carputils.bundle.bundle.BundleModule.finalize_bundle (   self,
  job_id = None 
)

Writes the protocol script in the bundle folder, modifies parameter files containing unresolved paths and creates a zip archive of the bundle if necessary.

Removes the bundle folder afterwards.

◆ modify_par_file()

def carputils.bundle.bundle.BundleModule.modify_par_file (   self,
  par_file 
)

Modify parameter file in order for paths to be consistent in the bundle and put the input files given as parameters in the bundle.

Parameters
par_filestr Path to the parameter file to modify.

◆ prepopulate_bundle_folder()

def carputils.bundle.bundle.BundleModule.prepopulate_bundle_folder (   self)

Initialize clean bundle folder by copying content of 'Mesh' and 'external' folders, as well as files and folders listed in '.bundleinclude' file.

◆ resolve_parfile_path()

def carputils.bundle.bundle.BundleModule.resolve_parfile_path (   self,
  path,
  current_param = None,
  mesh = False 
)

Put the file targeted by 'path' into the bundle if necessary and returns the path to this file in the bundle.

Parameters
pathstr path to the file
current_param_OCParam parameter associated to the path
meshbool set to True if the file is a mesh file
Returns
The relative path to the file in the bundle

Property Documentation

◆ bundle_dir

carputils.bundle.bundle.BundleModule.bundle_dir = property
static
Returns
Path to the bundle directory

◆ bundle_foldername

carputils.bundle.bundle.BundleModule.bundle_foldername = property
static
Returns
Name of the bundle folder

◆ exp_dir

carputils.bundle.bundle.BundleModule.exp_dir = property
static
Returns
Directory containing the protocol script

◆ exp_file

carputils.bundle.bundle.BundleModule.exp_file = property
static
Returns
Path to the protocol script

◆ exp_filename

carputils.bundle.bundle.BundleModule.exp_filename = property
static
Returns
Name of the protocol script

◆ exp_name

carputils.bundle.bundle.BundleModule.exp_name = property
static

The name of the experiment, defined in the command line as an argument for the –bundle option.

Default 'experiment'

Returns
Name of the experiment

◆ externaldir_name

carputils.bundle.bundle.BundleModule.externaldir_name = property
static
Returns
Name of the external directory

◆ file_OCparams

carputils.bundle.bundle.BundleModule.file_OCparams = property
static
Returns
List of OpenCARP parameters giving path to a file (RFile and WFile parameters)

◆ meshdir_name

carputils.bundle.bundle.BundleModule.meshdir_name = property
static
Returns
Name of the mesh directory

◆ OCparams

carputils.bundle.bundle.BundleModule.OCparams = property
static
Returns
List of OpenCARP parameters

◆ protocol_script

carputils.bundle.bundle.BundleModule.protocol_script = property
static
Returns
String containing the content of the protocol script

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