Ejemplo n.º 1
0
 def test_abort_from_submitting(self, add, delete, command_processor):
     """
     Testing when ABORT command is received when Job is in SUBMITTING state.
     Test if SUBMIT command received after is handled correctly and also the check status
     """
     command_processor.return_vaule = True
     job = Job.objects.create(
         type=PipelineType.CWL,
         app={
             "github": {
                 "version": "1.0.0",
                 "entrypoint": "test.cwl",
                 "repository": "",
             }
         },
         external_id="ext_id",
         status=Status.SUBMITTING,
     )
     add.return_value = True
     delete.return_value = True
     abort_job(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)
     command_processor(Command(CommandType.SUBMIT, str(job.id)).to_dict())
     check_job_status(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)
Ejemplo n.º 2
0
 def test_abort_from_failed(self):
     job = Job.objects.create(
         type=PipelineType.CWL,
         app={
             "github": {
                 "version": "1.0.0",
                 "entrypoint": "test.cwl",
                 "repository": "",
             }
         },
         external_id="ext_id",
         status=Status.FAILED,
     )
     abort_job(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.FAILED)
Ejemplo n.º 3
0
 def test_abort_from_suspended(self, abort):
     job = Job.objects.create(
         type=PipelineType.CWL,
         app={
             "github": {
                 "version": "1.0.0",
                 "entrypoint": "test.cwl",
                 "repository": "",
             }
         },
         external_id="ext_id",
         status=Status.SUSPENDED,
     )
     abort.return_value = True
     abort_job(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)
Ejemplo n.º 4
0
 def test_abort_fail_from_running(self, abort):
     job = Job.objects.create(
         type=PipelineType.CWL,
         app={
             "github": {
                 "version": "1.0.0",
                 "entrypoint": "test.cwl",
                 "repository": "",
             }
         },
         external_id="ext_id",
         status=Status.RUNNING,
     )
     abort.return_value = False
     with self.assertRaises(RetryException, msg="Invalid question kind"):
         abort_job(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.RUNNING)
Ejemplo n.º 5
0
 def test_abort_from_submitted(self, abort, command_processor):
     job = Job.objects.create(
         type=PipelineType.CWL,
         app={
             "github": {
                 "version": "1.0.0",
                 "entrypoint": "test.cwl",
                 "repository": "",
             }
         },
         external_id="ext_id",
         status=Status.SUBMITTED,
     )
     abort.return_value = True
     command_processor.return_value = True
     abort_job(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)
     check_job_status(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)
Ejemplo n.º 6
0
 def test_abort_from_created(self, command_processor):
     """
     Test reciving ABORT command when Job is in CREATED state
     """
     command_processor.return_vaule = True
     job = Job.objects.create(
         type=PipelineType.CWL,
         app={
             "github": {
                 "version": "1.0.0",
                 "entrypoint": "test.cwl",
                 "repository": "",
             }
         },
         external_id="ext_id",
         status=Status.CREATED,
     )
     abort_job(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)
     check_job_status(job)
     job.refresh_from_db()
     self.assertEqual(job.status, Status.ABORTED)