perfsim.environment#
Module contents#
Submodules#
perfsim.environment.perfsim_server module#
- class perfsim.environment.perfsim_server.PerfSimServer(host='0.0.0.0', port=8081, perf_logs=True, log_filename=None, log_format=None, log_level=20, debug=False)[source]#
Bases:
object
Initialize the server.
- Parameters:
host (
str
) – The host address for the server. Default is ‘0.0.0.0’port (
int
) – The port for the server. Default is 8081.perf_logs (
bool
) – Enable/disable the logs related to the execution time of math functions. Default is True.log_filename (
str
) – The filename for the log file. If None, the log will be written to the console.log_format (
str
) – The format for the log file. If None, the default format will be used.log_level (
int
) – The log level based on the logging module. If None, the logging.INFO will be used.debug (
bool
) – Enable/disable the debug mode. Default is False.
-
perf_logs:
bool
# Enable/disable the performance logging
-
app:
Dash
# The Dash app
-
server:
Flask
# The Flask server
-
sm:
Optional
[SimulationScenarioManager
]# The SimulationScenarioManager object, created from the scenario/config
- static make_error_response(error_code, error_message)[source]#
Make an error response.
- Parameters:
error_code (
int
) – The error code.error_message (
str
) – The error message.
- Return type:
Response
- Returns:
The error response.
- make_function_response(func, *args)[source]#
Make a response for a function call.
- Parameters:
func (
Callable
) – The function to call.args – The arguments to pass to the function.
- Return type:
Response
- Returns:
The response of type Response.
- property host#
Get the host address.
- Returns:
- property port#
Get the port number.
- Returns:
perfsim.environment.settings module#
- perfsim.environment.settings.get_space(size, low, high)[source]#
Get a space of size with low and high values.
- Parameters:
size
low
high
- Returns:
- perfsim.environment.settings.merge_spaces(spaces)[source]#
Merge multiple spaces into one.
- Parameters:
spaces
- Returns:
- class perfsim.environment.settings.Settings[source]#
Bases:
object
The Settings class is a class that contains the settings of the simulation.
- indices = ['ms_count', 'sc_edge_bytes', 'cfs_period_ns', 'ms_replica_cpu_requests_shares', 'ms_replica_cpu_limits', 'host_cpu_core_count', 'sc_arrival_rate', 'ms_replica_thread_count', 'ms_replica_count', 'host_network_bandwidth', 'host_cpu_clock_rate', 'ms_replica_thread_instructions', 'ms_replica_thread_avg_cpi', 'ms_replica_reserved_network_bandwidth', 'ms_replica_average_cpu_usage', 'ms_replica_thread_average_cpu_utilization', 'ms_replica_thread_weight', 'sched_min_granularity_ns', 'sched_latency_ns', 'load_balancing_threshold', 'nice_0_load']#
- columns = ['min', 'max', 'chunks']#
- data = [[1, 10, 10], [1000, 1000000, 10], [100, 100, 1], [512, 8192, 16], [512, 8192, 16], [8, 8, 1], [10, 10000, 10], [1, 10, 10], [1, 5, 5], [12500000, 1250000000, 2], [3400000000, 3400000000, 1], [1000000, 10000000000, 10], [1, 1, 1], [0, 0, 1], [10, 100, 10], [1, 1, 1], [1, 1, 1], [2, 2, 1], [6, 6, 1], [0, 0, 1], [1024, 1024, 1]]#
- args = min max chunks ms_count 1 10 10 sc_edge_bytes 1000 1000000 10 cfs_period_ns 100 100 1 ms_replica_cpu_requests_shares 512 8192 16 ms_replica_cpu_limits 512 8192 16 host_cpu_core_count 8 8 1 sc_arrival_rate 10 10000 10 ms_replica_thread_count 1 10 10 ms_replica_count 1 5 5 host_network_bandwidth 12500000 1250000000 2 host_cpu_clock_rate 3400000000 3400000000 1 ms_replica_thread_instructions 1000000 10000000000 10 ms_replica_thread_avg_cpi 1 1 1 ms_replica_reserved_network_bandwidth 0 0 1 ms_replica_average_cpu_usage 10 100 10 ms_replica_thread_average_cpu_utilization 1 1 1 ms_replica_thread_weight 1 1 1 sched_min_granularity_ns 2 2 1 sched_latency_ns 6 6 1 load_balancing_threshold 0 0 1 nice_0_load 1024 1024 1#
- chunks = {'cfs_period_ns': array([100]), 'host_cpu_clock_rate': array([3400000000]), 'host_cpu_core_count': array([8]), 'host_network_bandwidth': array([ 12500000, 1250000000]), 'load_balancing_threshold': array([0]), 'ms_count': array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 'ms_replica_average_cpu_usage': array([ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]), 'ms_replica_count': array([1, 2, 3, 4, 5]), 'ms_replica_cpu_limits': array([ 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192]), 'ms_replica_cpu_requests_shares': array([ 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192]), 'ms_replica_reserved_network_bandwidth': array([0]), 'ms_replica_thread_average_cpu_utilization': array([1]), 'ms_replica_thread_avg_cpi': array([1]), 'ms_replica_thread_count': array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 'ms_replica_thread_instructions': array([ 1000000, 1112000000, 2223000000, 3334000000, 4445000000, 5556000000, 6667000000, 7778000000, 8889000000, 10000000000]), 'ms_replica_thread_weight': array([1]), 'nice_0_load': array([1024]), 'sc_arrival_rate': array([ 10, 1120, 2230, 3340, 4450, 5560, 6670, 7780, 8890, 10000]), 'sc_edge_bytes': array([ 1000, 112000, 223000, 334000, 445000, 556000, 667000, 778000, 889000, 1000000]), 'sched_latency_ns': array([6]), 'sched_min_granularity_ns': array([2])}#
- action_spaces = {'ms_affinity': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])), 'ms_replica_count': (array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), array([5, 5, 5, 5, 5, 5, 5, 5, 5, 5])), 'ms_replica_cpu_limits': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([16, 16, 16, 16, 16, 16, 16, 16, 16, 16])), 'ms_replica_cpu_requests_shares': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([16, 16, 16, 16, 16, 16, 16, 16, 16, 16]))}#
- obs_spaces = {'arrival_rate': (array([0]), array([10])), 'cfs_period_ns': (array([1]), array([1])), 'host_cpu_clock_rate': (array([1]), array([1])), 'host_cpu_core_count': (array([1]), array([1])), 'host_network_bandwidth': (array([1]), array([2])), 'ms_affinity_rules': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])), 'ms_replica_average_cpu_usage': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([10, 10, 10, 10, 10, 10, 10, 10, 10, 10])), 'ms_replica_count': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([5, 5, 5, 5, 5, 5, 5, 5, 5, 5])), 'ms_replica_cpu_limits': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([16, 16, 16, 16, 16, 16, 16, 16, 16, 16])), 'ms_replica_cpu_requests_shares': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([16, 16, 16, 16, 16, 16, 16, 16, 16, 16])), 'ms_replica_net_bandwidth': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), 'ms_replica_thread_average_cpu_utilization': (array([0]), array([1])), 'ms_replica_thread_avg_cpi': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])), 'ms_replica_thread_count': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([10, 10, 10, 10, 10, 10, 10, 10, 10, 10])), 'ms_replica_thread_instructions': (array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), array([10, 10, 10, 10, 10, 10, 10, 10, 10, 10])), 'sc_edge': (array([0, 0, 0, 0, 0, 0, 0, 0, 0]), array([10, 10, 10, 10, 10, 10, 10, 10, 10]))}#
- action_space = {'high': array([ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]), 'low': array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])}#
- observation_space = {'high': array([ 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1]), 'low': array([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])}#
- index = 'nice_0_load'#
- row = min 1024 max 1024 chunks 1 Name: nice_0_load, dtype: int64#