Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
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"])
Exemple #4
0
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"])
Exemple #5
0
 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)
Exemple #6
0
 def test_kill_jobs_invalid_credential(self):
     results = interface.kill_jobs(None, [''])
     self.assertEqual(results["error"], CRED_ERROR)
Exemple #7
0
 def test_kill_jobs_staff_error(self):
     results = interface.kill_jobs(self.credential, [''])
     self.assertEqual(results["error"], KILL_ERROR)
Exemple #8
0
 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)
Exemple #9
0
 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)
Exemple #10
0
 def test_kill_jobs_invalid_credential(self):
     results = interface.kill_jobs(None, [''])
     self.assertEqual(results["error"], CRED_ERROR)
Exemple #11
0
 def test_kill_jobs_staff_error(self):
     results = interface.kill_jobs(self.credential, [''])
     self.assertEqual(results["error"], KILL_ERROR)