5456821a4abed83c2e7f57c0bdbf1af093cbddb9,sos/hosts.py,LocalHost,prepare_task,#LocalHost#Any#,125

Before Change


            shutil.copyfile(def_file, task_file)
        else:
            // add server restriction on task file
            with open(def_file, "rb") as task:
                params = pickle.load(task)
                task_vars = params.data[1]

            task_vars["_runtime"]["max_mem"] = self.config.get("max_mem", None)
            task_vars["_runtime"]["max_cores"] = self.config.get("max_cores", None)
            task_vars["_runtime"]["max_walltime"] = self.config.get("max_walltime", None)
            if task_vars["_runtime"]["max_walltime"] is not None:
                task_vars["_runtime"]["max_walltime"] = format_HHMMSS(task_vars["_runtime"]["max_walltime"])

            if self.config.get("max_mem", None) is not None and task_vars["_runtime"].get("mem", None) is not None \
                    and self.config["max_mem"] < task_vars["_runtime"]["mem"]:
                raise ValueError("Task {} requested more mem ({}) than allowed max_mem ({})".format(
                    task_id, task_vars["_runtime"]["mem"], self.config["max_mem"]))
            if self.config.get("max_cores", None) is not None and task_vars["_runtime"].get("cores", None) is not None \
                    and self.config["max_cores"] < task_vars["_runtime"]["cores"]:
                raise ValueError("Task {} requested more cores ({}) than allowed max_cores ({})".format(
                    task_id, task_vars["_runtime"]["cores"], self.config["max_cores"]))
            if self.config.get("max_walltime", None) is not None and task_vars["_runtime"].get("walltime", None) is not None \
                    and expand_time(self.config["max_walltime"]) < expand_time(task_vars["_runtime"]["walltime"]):
                raise ValueError("Task {} requested more walltime ({}) than allowed max_walltime ({})".format(
                    task_id, task_vars["_runtime"]["walltime"], self.config["max_walltime"]))

            new_param = TaskParams(
                name = params.name,
                data = (
                    params.data[0],
                    task_vars,
                    params.data[2],
                )
            )
            with open(task_file, "wb") as jf:

After Change


            shutil.copyfile(def_file, task_file)
        else:
            // add server restriction on task file
            params = loadTask(def_file)
            task_vars = params.sos_dict

            task_vars["_runtime"]["max_mem"] = self.config.get("max_mem", None)
            task_vars["_runtime"]["max_cores"] = self.config.get("max_cores", None)
            task_vars["_runtime"]["max_walltime"] = self.config.get("max_walltime", None)
            if task_vars["_runtime"]["max_walltime"] is not None:
                task_vars["_runtime"]["max_walltime"] = format_HHMMSS(task_vars["_runtime"]["max_walltime"])

            if self.config.get("max_mem", None) is not None and task_vars["_runtime"].get("mem", None) is not None \
                    and self.config["max_mem"] < task_vars["_runtime"]["mem"]:
                raise ValueError("Task {} requested more mem ({}) than allowed max_mem ({})".format(
                    task_id, task_vars["_runtime"]["mem"], self.config["max_mem"]))
            if self.config.get("max_cores", None) is not None and task_vars["_runtime"].get("cores", None) is not None \
                    and self.config["max_cores"] < task_vars["_runtime"]["cores"]:
                raise ValueError("Task {} requested more cores ({}) than allowed max_cores ({})".format(
                    task_id, task_vars["_runtime"]["cores"], self.config["max_cores"]))
            if self.config.get("max_walltime", None) is not None and task_vars["_runtime"].get("walltime", None) is not None \
                    and expand_time(self.config["max_walltime"]) < expand_time(task_vars["_runtime"]["walltime"]):
                raise ValueError("Task {} requested more walltime ({}) than allowed max_walltime ({})".format(
                    task_id, task_vars["_runtime"]["walltime"], self.config["max_walltime"]))

            new_param = TaskParams(
                name = params.name,
                task = params.task,
                sos_dict = params.sos_dict,
                sigil = params.sigil
            )
            new_param.save(task_file)
        return True
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: vatlab/SoS
Commit Name: 5456821a4abed83c2e7f57c0bdbf1af093cbddb9
Time: 2017-05-11
Author: ben.bog@gmail.com
File Name: sos/hosts.py
Class Name: LocalHost
Method Name: prepare_task


Project Name: vatlab/SoS
Commit Name: 5456821a4abed83c2e7f57c0bdbf1af093cbddb9
Time: 2017-05-11
Author: ben.bog@gmail.com
File Name: sos/hosts.py
Class Name: LocalHost
Method Name: prepare_task


Project Name: vatlab/SoS
Commit Name: 5456821a4abed83c2e7f57c0bdbf1af093cbddb9
Time: 2017-05-11
Author: ben.bog@gmail.com
File Name: sos/sos_task.py
Class Name:
Method Name: execute_task


Project Name: vatlab/SoS
Commit Name: 7d3e4525ea8f768917c9a2e2ba1788fc3fe5cda0
Time: 2017-05-12
Author: ben.bog@gmail.com
File Name: sos/PBS/sos_task.py
Class Name: PBS_TaskEngine
Method Name: execute_task