alib.util
¶
-
exception
alib.util.
AlibPathError
¶
-
class
alib.util.
CodebaseDeployer
(code_base_id, remote_base_dir, extra=None, local_base_path='.', servers=None, export_path='deployment', cleanup=True)¶ This class simplifies deployment of the code.
-
deploy_codebase
()¶ Make a copy of the codebase and deploy it on the servers. :return:
-
-
exception
alib.util.
DeploymentError
¶
-
class
alib.util.
ExperimentPathHandler
¶ This class handles the paths related to the execution of experiments or the generation of scenarios using alib.
To use it, run ExperimentPathHandler.initialize() to initialize the variables described below:
- ALIB_DIR:
This is the parent folder for any experiments to be run on the server.
It is equal to the environment variable ALIB_EXPERIMENT_HOME if it is set.
Otherwise the code traverses up through the file system starting at this file’s location (paths.py) until it finds a path containing the subfolders “input”, “output”, “log” and “sca”, indicating that this is the root folder of the experiment. ALIB_DIR is then set to the parent of this directory.
Finally, if no matching alib folder can be found, the default is to use the relative path “../../..”.
- EXPERIMENT_DIR:
- This is the directory containing the “input”, “output”, “log” and “sca” folders for the current experiment. It is found by
- INPUT_DIR:
- This is the path containing any configuration files, scenario pickle files and similar files, as provided in the optional “extras” argument in deployment.
- LOG_DIR:
- This is the path, where log files related to the experiment should be stored.
- OUTPUT_DIR:
- This is the path where the results of this execution should be stored results.
- CODE_DIR:
- This is the path containing the deployed codebase. This path is added to the system path variable to enable importing modules from the entire codebase.
LOG_DIR and OUTPUT_DIR are required to be empty to avoid accidental overwriting of previous results.
-
ALIB_DIR
= None¶
-
CODE_DIR
= None¶
-
CURRENT_FILE_DIR
= '/home/alex/inet/vnep/alib/alib'¶
-
EXPERIMENT_DIR
= None¶
-
INPUT_DIR
= None¶
-
LOG_DIR
= './log'¶
-
OUTPUT_DIR
= None¶
-
static
initialize
()¶
-
class
alib.util.
PrettyPrinter
(indent_offset=0, indent_step=2, whitelist=None, max_depth=10000)¶ -
pprint
(obj)¶ Generate a string representation of the object and its attributes.
Parameters: obj – A python object Returns: pretty printed string
-
-
class
alib.util.
PrintLogger
¶ -
static
critical
(message, *args, **kwargs)¶
-
static
debug
(message, *args, **kwargs)¶
-
static
error
(message, *args, **kwargs)¶
-
static
info
(message, *args, **kwargs)¶
-
static
log
(message, *args, **kwargs)¶
-
static
warning
(message, *args, **kwargs)¶
-
static
-
exception
alib.util.
RangeError
¶
-
alib.util.
approx_equal
(x, y, accuracy=0.0001)¶
-
alib.util.
check_bool
(value, none_allowed=True)¶
-
alib.util.
check_int
(value, none_allowed=True)¶
-
alib.util.
check_percentage
(value, none_allowed=True)¶
-
alib.util.
check_positive
(value, none_allowed=True)¶
-
alib.util.
check_within_range
(value, min, max, none_allowed=True)¶
-
alib.util.
get_graph_viz_string
(graph, directed=True, get_edge_style=<function <lambda>>)¶
-
alib.util.
get_logger
(logger_name, make_file=True, make_stream=False, print_level=20, file_level=10, propagate=True)¶
-
alib.util.
get_obj_gap
(objective, bound)¶
-
alib.util.
graph_viz_edge_color_according_to_request_list
(edge_set_list, colors=None)¶
-
alib.util.
initialize_root_logger
(filename, print_level=20, file_level=10)¶
-
alib.util.
log_start_and_end_of_function
(logger=<class 'alib.util.PrintLogger'>, start_message='Start: {f}({args})', end_message='End: {f}({args}) after {t} s.')¶
-
alib.util.
pretty_print
(obj, indentOffset=0, indentStep=2, whitelist=None, max_depth=10000)¶