hbp_nrp_commons.workspace.SimUtil module

This module implements Utility functions used backend

class SimUtil[source]

Bases: object

Utility methods for a simulation

static clear_dir(directory)[source]

Deletes contents of a directory

static delete_simulation_dir(sim_dir=None)[source]

Removes simulation directory Check that you are deleting the right folder by checking the sim_id

static extract_sim_id(sim_dir)[source]
Parameters

sim_dir – the address of temp folder

Returns

returns the the sim_id embedded in sim_dir.

static find_file_in_paths(file_rel_path, path_list)[source]
Returns

returns the absolute path of the first file found path_list. if not found returns and empty string.

static init_simulation_dir(sim_id)[source]

Creates a temporary directory and links it to Settings.sim_dir_symlink

Params sim_id

simulation ID of the simulation we’re going to create a temp dir for we embed the sim_id into simulation temp dir so the delete_simulation_dir deletes correctly

Returns sim_dir

the full path of the address of temp dir for the simulation

static makedirs(directory)[source]

Creates [nested] directory if not exists

Raises

all errors except directory exists

static mkdir(directory)[source]

Creates [nested] directory if not exists

Raises

all errors except directory exists

static rmdir(directory)[source]

Removes [nested] directory if not exists

Raises

all errors except directory exists