Beispiel #1
0
def job_success(result, jobid):
    try:
        (frontend_scanid, filename, probe) = job_ctrl.info(jobid)
        log.info("scanid %s jobid:%d probe %s",
                 frontend_scanid,
                 jobid,
                 probe)
        celery_frontend.scan_result(frontend_scanid, filename, probe, result)
        job_ctrl.success(jobid)
    except:
        log.info("exception", exc_info=True)
        return
 def test_scan_progress(self):
     scan_id = scan_ctrl.new(self.scanid, self.userid, 10)
     job_ids = []
     for i in xrange(0, 10):
         for probe in ['probe1', 'probe2']:
             job_ids.append(job_ctrl.new(scan_id, "file-{0}".format(i),
                                         probe, 1))
     scan_ctrl.launched(scan_id)
     shuffle(job_ids)
     for i, job_id in enumerate(job_ids[:-1]):
         job_ctrl.success(job_id)
         (status, progress_details) = scan_ctrl.progress(scan_id)
         self.assertEqual(status,
                          IrmaScanStatus.label[IrmaScanStatus.launched])
         self.assertIsNotNone(progress_details)
         self.assertEqual(progress_details['successful'], i + 1)
 def test_scan_job_success(self):
     scan_id = scan_ctrl.new(self.scanid, self.userid, 10)
     job_ids = []
     for i in xrange(0, 10):
         for probe in ['probe1', 'probe2']:
             job_ids.append(job_ctrl.new(scan_id, "file-{0}".format(i),
                                         probe, 1))
     scan_ctrl.launched(scan_id)
     shuffle(job_ids)
     for job_id in job_ids:
         job_ctrl.success(job_id)
     self.assertTrue(scan_ctrl.check_finished(scan_id))
     with session_query() as session:
         scan = Scan.load(scan_id, session)
         self.assertEqual(scan.status, IrmaScanStatus.processed)
         self.assertEqual(scan.nb_files, 10)
         self.assertEqual(scan.nb_jobs, 20)