accasim.utils.reader_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.reader_class.
DefaultReader
(filepath, job_factory=None, parser=None, tweak_function=None, max_lines=None, start_time=0, equivalence={})[source]¶ Bases:
accasim.utils.reader_class.Reader
A default implementation of the reader class. This implementation works reading a workload file line by line.
-
class
accasim.utils.reader_class.
DefaultTweaker
(start_time, system_resources=None, equivalence=None)[source]¶ Bases:
accasim.utils.reader_class.Tweaker
-
tweak_function
(_dict)[source]¶ As in the SWF workload logs the numbers of cores are not expressed, just the number of requested processors, we have to tweak this information i.e we replace the number of processors by the number of requested cores.
The equivalence from processor to core is given in the system config file. As in the example, one processor contains two cores. Then the number of cores will be processor * core. Besides, memory is expressed in kB per processor.
Example: >>> "equivalence": { >>> "processor": { >>> "core": 2 >>> } >>> }
Parameters: _dict – Dictionary to be tweaked. Returns: The tweaked dictionary.
-
-
class
accasim.utils.reader_class.
DefaultWorkloadParser
[source]¶
-
class
accasim.utils.reader_class.
Reader
(_job_factory)[source]¶ Bases:
abc.ABC
This class is used to simulate the creation of jobs from HPC users. This is an abstract class. The main method is read, which must be implemented to return the set of next submission for the system.
Note: A default implementation is named as DefaultReader. This class read from a single file, and use a SWF parser to extract the jobs. -
next
(current_time, time_points=2, stime_name='queued_time')[source]¶ Laods the data and generates the jobs that belongs to the corresponding next time_points.
Parameters: - current_time – Current simulated point.
- time_points – Number of submission points to be loaded
- stime_name – Name of the attribute (key dictionary) of the submit/queue time
Returns: A tuple composed with an array of the next time points sorted chronologically and a Dictionary with an array for each time point {time_point: [job_1, …, job_n]}
-