def test_kill_jobs_run_through_no_job(self): results = run_fake_job(self.credential2, 10) jobid = results["jobid"] models.Job.objects.filter(credential=self.credential2, jobid=jobid).delete() results = interface.kill_jobs(self.credential2, [jobid]) self.assertEqual(results["error"], None)
def test_kill_jobs_run_through_no_job(self): results = run_fake_job(self.credential2, 10) jobid = results["jobid"] models.Job.objects.filter( credential=self.credential2, jobid=jobid).delete() results = interface.kill_jobs(self.credential2, [jobid]) self.assertEqual(results["error"], None)
def kill_job(request, cluster): if request.method != "POST": return redirect(job_index) jobids = [] for key in request.POST: try: int(key) jobids.append(key) except ValueError: logger.warn("Invalid key '%s' for cluser '%s'" % (key, cluster)) pass credential = Credential.objects.get( user=request.user, cluster__name=cluster) result = interface.kill_jobs(credential, jobids) if result["error"] is None: return redirect(job_index) else: return HttpResponse(result["error"])
def kill_job(request, cluster): if request.method != "POST": return redirect(job_index) jobids = [] for key in request.POST: try: int(key) jobids.append(key) except ValueError: logger.warn("Invalid key '%s' for cluser '%s'" % (key, cluster)) pass credential = Credential.objects.get(user=request.user, cluster__name=cluster) result = interface.kill_jobs(credential, jobids) if result["error"] is None: return redirect(job_index) else: return HttpResponse(result["error"])
def test_kill_jobs_run_through(self): results = run_fake_job(self.credential2, 10) jobid = results["jobid"] results = interface.kill_jobs(self.credential2, [jobid]) self.assertEqual(results["error"], None)
def test_kill_jobs_invalid_credential(self): results = interface.kill_jobs(None, ['']) self.assertEqual(results["error"], CRED_ERROR)
def test_kill_jobs_staff_error(self): results = interface.kill_jobs(self.credential, ['']) self.assertEqual(results["error"], KILL_ERROR)
def test_kill_jobs_run_through(self): results = interface.run_job(self.credential2, '', jobstring='sleep 10') jobid = results["jobid"] results = interface.kill_jobs(self.credential2, [jobid]) self.assertEqual(results["error"], None)