def _wload_rtapp(self, wl_idx, wlspec, cpus): conf = wlspec['conf'] self._log.debug('Configuring [%s] rt-app...', conf['class']) # Setup a default "empty" task name prefix if 'prefix' not in conf: conf['prefix'] = 'task_' # Setup a default loadref CPU loadref = None if 'loadref' in wlspec: loadref = wlspec['loadref'] if conf['class'] == 'profile': params = {} # Load each task specification for task_name, task in conf['params'].items(): if task['kind'] not in wlgen.__dict__: self._log.error('RTA task of kind [%s] not supported', task['kind']) raise ValueError( 'unsupported "kind" value for task [{}] ' 'in RT-App workload specification'.format(task)) task_ctor = getattr(wlgen, task['kind']) num_tasks = task.get('tasks', 1) task_idxs = self._wload_task_idxs(wl_idx, num_tasks) for idx in task_idxs: idx_name = "_{}".format(idx) if len(task_idxs) > 1 else "" task_name_idx = conf['prefix'] + task_name + idx_name params[task_name_idx] = task_ctor(**task['params']).get() rtapp = wlgen.RTA(self.target, wl_idx, calibration=self.te.calibration()) rtapp.conf(kind='profile', params=params, loadref=loadref, cpus=cpus, run_dir=self.te.run_dir, duration=conf.get('duration')) return rtapp if conf['class'] == 'periodic': task_idxs = self._wload_task_idxs(wl_idx, conf['tasks']) params = {} for idx in task_idxs: task = conf['prefix'] + str(idx) params[task] = wlgen.Periodic(**conf['params']).get() rtapp = wlgen.RTA(self.target, wl_idx, calibration=self.te.calibration()) rtapp.conf(kind='profile', params=params, loadref=loadref, cpus=cpus, run_dir=self.te.run_dir, duration=conf.get('duration')) return rtapp if conf['class'] == 'custom': rtapp = wlgen.RTA(self.target, wl_idx, calibration=self.te.calibration()) rtapp.conf(kind='custom', params=conf['json'], duration=conf.get('duration'), loadref=loadref, cpus=cpus, run_dir=self.te.run_dir) return rtapp raise ValueError('unsupported \'class\' value for [{}] ' 'RT-App workload specification'.format(wl_idx))
def wload_rtapp(cls, wl_idx, wlspec, cpus): conf = wlspec['conf'] logging.debug(r'%14s - Configuring [%s] rt-app...', 'RTApp', conf['class']) # Setup a default "empty" task name prefix if 'prefix' not in conf: conf['prefix'] = 'task_' # Setup a default loadref CPU loadref = None if 'loadref' in wlspec: loadref = wlspec['loadref'] if conf['class'] == 'profile': params = {} # Load each task specification for task_name in conf['params']: task = conf['params'][task_name] task_name = conf['prefix'] + task_name if task['kind'] not in wlgen.RTA.__dict__: logging.error( r'%14s - RTA task of kind [%s] not supported', 'RTApp', task['kind']) raise ValueError('Configuration error - ' 'unsupported \'kind\' value for task [{}] '\ 'in RT-App workload specification'\ .format(task)) task_ctor = getattr(wlgen.RTA, task['kind']) params[task_name] = task_ctor(**task['params']) rtapp = wlgen.RTA(cls.env.target, wl_idx, calibration=cls.env.calibration()) rtapp.conf(kind='profile', params=params, loadref=loadref, cpus=cpus, run_dir=cls.env.run_dir) return rtapp if conf['class'] == 'periodic': task_idxs = cls.wload_rtapp_task_idxs(wl_idx, conf['tasks']) params = {} for idx in task_idxs: task = conf['prefix'] + str(idx) params[task] = wlgen.RTA.periodic(**conf['params']) rtapp = wlgen.RTA(cls.env.target, wl_idx, calibration=cls.env.calibration()) rtapp.conf(kind='profile', params=params, loadref=loadref, cpus=cpus, run_dir=cls.env.run_dir) return rtapp if conf['class'] == 'custom': rtapp = wlgen.RTA(cls.env.target, wl_idx, calibration=cls.env.calib) rtapp.conf(kind='custom', params=conf['json'], duration=conf['duration'], loadref=loadref, cpus=cpus, run_dir=cls.env.run_dir) return rtapp raise ValueError('Configuration error - ' 'unsupported \'class\' value for [{}] '\ 'RT-App workload specification'\ .format(wl_idx))