def cancel_job(self,job): success = mig.cancel_job(job["id"]) if success: #print "Cancelled job : "+job["id"] log(self.logfile,"Cancelled job : "+job["id"],self.debug_mode) else: log(self.logfile,"Unsuccesful cancellation of job :"+job["id"],self.debug_mode)
#jobs = data_dict["timesteps"][-1]["jobs"] output = "" try: os.kill(data_dict["pid"], signal.SIGTERM) output += "\n Grid solver process terminated." except OSError, err: if err.errno == 3: output += "\n Grid solver process is not running." else: output += "Error: "+str(err) for j in data_dict["timesteps"][-1]["jobs"]: if data_dict.has_key("grid_enabled") and not data_dict["grid_enabled"]: mig.local_mode_on() try: output += str(mig.cancel_job(j["job_id"])) #j["status"] = mig.job_status(j["job_id"]) except Exception, e: output += "Error : "+str(e) #output += str(traceback.format_exc()) #traceback.print_exc() #solver_data["timesteps"][-1]["status"] = "The server process has been cancelled." #data_dict["state"] = "Cancelled" try : update_solver_data(name, status="The server process has been cancelled.", state="Cancelled") except Exception, e : output += str(e)