Esempio n. 1
0
def get_info(queue_name):
    log.debug("queue_name: %s", queue_name)
    async_call(probe_app,
               "probe.tasks",
               "register",
               routing_key=queue_name)
    return
Esempio n. 2
0
def get_info(queue_name):
    log.debug("queue_name: %s", queue_name)
    async_call(probe_app,
               "probe.tasks",
               "register",
               routing_key=queue_name)
    return
Esempio n. 3
0
 def test003_async_call_raise(self):
     app = MagicMock()
     app.send_task.side_effect = TimeoutError("whatever")
     path, name = "p_test", "n_test"
     expected = "Celery error - %s" % name
     with self.assertRaises(IrmaTaskError) as context:
         module.async_call(app, path, name)
     self.assertEqual(str(context.exception), expected)
Esempio n. 4
0
def scan_result(file, probe, result):
    hook_error = route(frontend_app.signature("frontend_app.scan_result_error",
                       [file, probe, result]))
    async_call(frontend_app,
               "frontend_app",
               "scan_result",
               args=[file, probe, result],
               link_error=hook_error
               )
Esempio n. 5
0
def scan_result(file, probe, result):
    hook_error = route(
        frontend_app.signature("frontend_app.scan_result_error",
                               [file, probe, result]))
    async_call(frontend_app,
               "frontend_app",
               "scan_result",
               args=[file, probe, result],
               link_error=hook_error)
Esempio n. 6
0
 def test004_async_call_ok(self):
     app = MagicMock()
     path, name, karg = "p_test", "n_test", "k_test"
     expected = ("s_test", "r_test")
     args = (("%s.%s" % (path, name),), {"karg": karg})
     app.send_task.return_value = expected
     result = module.async_call(app, path, name, karg=karg)
     self.assertEqual(result, expected)
     self.assertEqual(app.send_task.call_args, args)
Esempio n. 7
0
def job_launch(ftpuser, frontend_scanid, filename, probe, job_id, task_id):
    """ send a task to the brain to flush the scan files"""
    hook_success = route(
        results_app.signature("brain.tasks.job_success",
                              [job_id]))
    hook_error = route(
        results_app.signature("brain.tasks.job_error",
                              [job_id]))
    task = async_call(probe_app,
                      "probe.tasks",
                      "probe_scan",
                      args=(ftpuser, frontend_scanid, filename),
                      queue=probe,
                      link=hook_success,
                      link_error=hook_error,
                      uuid=task_id)
    return task.id
Esempio n. 8
0
def job_launch(ftpuser, frontend_scanid, filename, probe, task_id):
    """ send a task to the brain to flush the scan files"""
    log.debug("scanid %s: ftpuser %s filename %s probe %s" +
              " task_id %s",
              frontend_scanid, ftpuser, filename, probe, task_id)
    hook_success = route(
        results_app.signature("brain.results_tasks.job_success",
                              [frontend_scanid, filename, probe]))
    hook_error = route(
        results_app.signature("brain.results_tasks.job_error",
                              [frontend_scanid, filename, probe]))
    task = async_call(probe_app,
                      "probe.tasks",
                      "probe_scan",
                      args=(ftpuser, frontend_scanid, filename),
                      routing_key=probe,
                      link=hook_success,
                      link_error=hook_error,
                      task_id=task_id)
    return task.id
Esempio n. 9
0
def scan_result(frontend_scanid, filename, probe, result):
    async_call(frontend_app,
               "frontend.tasks",
               "scan_result",
               args=[frontend_scanid, filename, probe, result])
Esempio n. 10
0
def scan_launched(frontend_scanid, scan_request):
    async_call(frontend_app,
               "frontend.tasks",
               "scan_launched",
               args=[frontend_scanid, scan_request])
Esempio n. 11
0
def scan_launched(frontend_scanid):
    async_call(frontend_app, "frontend.tasks", "scan_launched", args=[frontend_scanid])