def get_memory_walltime(self, job_name, job_type='batch'): """ get memory, walltime and number of threads for the job from job_defaults.cfg :param job_name: the job file name :param job_type: 'batch' or 'script' """ config = putils.get_config_defaults(config_file='job_defaults.cfg') if job_type == 'batch': step_name = '_' step_name = step_name.join(job_name.split('/')[-1].split('_')[2::]) else: step_name = job_name if self.prefix == 'tops' and job_type == 'batch': if self.num_bursts is None: self.num_bursts = putils.get_number_of_bursts(self.inps) if self.num_bursts: number_of_bursts = self.num_bursts else: number_of_bursts = 1 if self.memory in [None, 'None']: if step_name in config: c_memory = config[step_name]['c_memory'] s_memory = config[step_name]['s_memory'] else: c_memory = config['default']['c_memory'] s_memory = config['default']['s_memory'] self.default_memory = putils.scale_memory(number_of_bursts, c_memory, s_memory) else: self.default_memory = self.memory if self.wall_time in [None, 'None']: if step_name in config: c_walltime = config[step_name]['c_walltime'] s_walltime = config[step_name]['s_walltime'] else: c_walltime = config['default']['c_walltime'] s_walltime = config['default']['s_walltime'] self.default_wall_time = putils.scale_walltime(number_of_bursts, self.wall_time_factor, c_walltime, s_walltime, self.scheduler) else: #self.default_wall_time = self.wall_time c_walltime = self.wall_time s_walltime = '0' self.default_wall_time = putils.scale_walltime(number_of_bursts, self.wall_time_factor, c_walltime, s_walltime, self.scheduler) if step_name in config: self.default_num_threads = config[step_name]['num_threads'] else: self.default_num_threads = config['default']['num_threads'] return
def get_memory_walltime(self, job_name, job_type='batch'): """ get memory, walltime and number of threads for the job from job_defaults.cfg :param job_name: the job file name :param job_type: 'batch' or 'script' """ config = putils.get_config_defaults(config_file='job_defaults.cfg') if job_type == 'batch': step_name = '_' step_name = step_name.join(job_name.split('/')[-1].split('_')[2::]) else: step_name = job_name if self.memory in [None, 'None']: if step_name in config: self.default_memory = config[step_name]['memory'] else: self.default_memory = config['DEFAULT']['memory'] else: self.default_memory = self.memory if self.wall_time in [None, 'None']: if step_name in config: self.default_wall_time = config[step_name]['walltime'] if config[step_name]['adjust'] == 'True': if self.num_bursts is None: self.num_bursts = putils.get_number_of_bursts(self) else: self.default_wall_time = config['DEFAULT']['walltime'] self.default_wall_time = putils.walltime_adjust( self.num_bursts, self.default_wall_time, self.scheduler, adjust=config[step_name]['adjust']) else: self.default_wall_time = self.wall_time if step_name in config: self.default_num_threads = config[step_name]['num_threads'] else: self.default_num_threads = config['DEFAULT']['num_threads'] return