示例#1
0
    def rqmt(self):
        if callable(self._rqmt):
            rqmt = self._rqmt()
        else:
            rqmt = self._rqmt

        # Ensure that the requested memory is a float representing GB
        if 'mem' in rqmt:
            rqmt['mem'] = tools.str_to_GB(rqmt['mem'])
        if 'time' in rqmt:
            rqmt['time'] = tools.str_to_hours(rqmt['time'])
        return rqmt
示例#2
0
文件: task.py 项目: slyforce/sisyphus
    def update_rqmt(self, initial_rqmt, submit_history, task_id):
        """ Update task requirements of interrupted job """
        initial_rqmt = initial_rqmt.copy()
        initial_rqmt['mem'] = tools.str_to_GB(initial_rqmt['mem'])
        initial_rqmt['time'] = tools.str_to_hours(initial_rqmt['time'])
        usage_file = self._job._sis_path(gs.PLOGGING_FILE + '.' + self.name(), task_id, abspath=True)

        try:
            last_usage = literal_eval(open(usage_file).read())
        except (SyntaxError, IOError):
            # we don't know anything if no usage file is writen or is invalid, just reuse last rqmts
            return initial_rqmt

        rresources = last_usage['requested_resources']
        if 'mem' in rresources:
            rresources['mem'] = tools.str_to_GB(rresources['mem'])
        if 'time' in rresources:
            rresources['time'] = tools.str_to_hours(rresources['time'])
        new_rqmt = self._update_rqmt(initial_rqmt=initial_rqmt, last_usage=last_usage)
        new_rqmt = gs.check_engine_limits(new_rqmt, self)
        return new_rqmt