MFLib¶
MFLib is the main class that is used to interact with the Measurement Framework set up in a user’s FABRIC Experiment.
- class mflib.mflib.MFLib(slice='', local_storage_directory='/tmp/mflib', mf_repo_branch='main', optimize_repos=False)¶
Bases:
CoreMFLib allows for adding and controlling the MeasurementFramework in a Fabric experiementers slice.
- static addMeasNode(slice, cores=4, ram=16, disk=500, site='EDC', image='docker_ubuntu_20')¶
Adds Measurement node and measurement network to an unsubmitted slice object.
- Parameters:
slice (fablib.slice) – Slice object already set with experiment topology.
cores (int, optional) – Cores for measurement node. Defaults to 4 cores.
ram (int, optional) – _description_. Defaults to 16 GB ram.
disk (int, optional) – _description_. Defaults to 500 GB disk.
network_type (string, optional) – _description_. Defaults to FABNetv4.
site (string, optional) – _description_. Defaults to NCSA.
- add_mflib_log_handler(log_handler)¶
Adds the given log handler to the mflib_logger. Note log handler needs to be created with set_mflib_logger first.
- Parameters:
log_handler (logging handler) – Log handler to add to the mflib_logger.
- download_common_hosts()¶
Downloads hosts.ini file and returns file text. Downloaded hosts.ini file will be stored locally for future reference.
- init(slice, optimize_repos)¶
Sets up the slice to ensure it can be monitored. Sets up basic software on Measurement Node and experiment nodes. Slice must already have a Measurement Node. See log file for details of init output.
- Parameters:
slice_name (str) – The name of the slice to be monitored.
- Returns:
False if no Measure Node found or a init process fails. True otherwise.
- Return type:
Bool
- instrumentize(services=['prometheus', 'elk'])¶
Instrumentize the slice. This is a convenience method that sets up & starts the monitoring of the slice. Sets up Prometheus, ELK & Grafana.
- Parameters:
services (List of Strings) – Just add the listed components. Options are elk or prometheus.
- Returns:
The output from each phase of instrumetizing.
- Return type:
dict
- mflib_class_version = '1.0.42'¶
- remove_mflib_log_handler(log_handler)¶
Removes the given log handler from the mflib_logger.
- Parameters:
log_handler (logging handler) – Log handler to remove from mflib_logger
- set_mflib_logger()¶
Sets up the mflib logging file. The filename is created from the self.logging_filename. Note that the self.logging_filename will be set with the slice when the slice name is set.
This method uses the logging filename inherited from Core.