accasim.utils.visualization_class module¶
MIT License
Copyright (c) 2017 cgalleguillosm
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
class
accasim.utils.visualization_class.SystemUtilization(datasource, system_info, min_time=600, max_time=1800)[source]¶ Bases:
objectUsing the matplotlib animation feature, this class will create a plot and update it during the simulation execution.
-
job_draw(i)[source]¶ Using the matplotlib animation the new jobs are draw into the plot. Besides previous jobs, axis info, legends are updated.
-
job_normalization(current_time, job)[source]¶ Jobs are normalized in terms of the current visualization, setting as min and max the maximum width of the patch :param current_time: Current time of the simulation. :param job: Job object.
Returns: Return the min and max positions of the patch
-
load_new_jobs(current_time, running_jobs, _resources)[source]¶ Loads new jobs into the jobs that are “running” in the plot. Checks first if it is already in the plot, if not it is added. The jobs are sorted in regards of the resource utilization. :param current_time: Current simulation time. :param running_jobs: list of running jobs. :param _resources:
-
modify_legend(ax, res, legend_size=10)[source]¶ Modify the lenged of the resource type in regards of the jobs that use most the resources. Only a subset of jobs will be in the legend. By default 10.
Parameters: - ax – Axis object
- res – Axis resource name
- legend_size – Default 10. Size of the legend.
-
next_color()[source]¶ Moves for all available matplotlib colors
Returns: Return an specific color to represent a job.
-
start_line_draw(current_time)[source]¶ Draws the current time line and add the corresponding text :param current_time: Current simulation time
-
update_finished_jobs(_finished_jobs)[source]¶ Patches of completed jobs are removed from the chart :param _finished_jobs: Array list of job’s Id
-
update_running_job(_patches, _res, _used)[source]¶ Updates the position of the patch in regards of the utilization of the resource
Parameters: - _patches – Patch objects corresponding to a job.
- _res – Name of the resource type
- _used – How much the job uses of the resoure type.
-