コード例 #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
コード例 #2
0
ファイル: probetasks.py プロジェクト: quarkslab/irma
def get_info(queue_name):
    log.debug("queue_name: %s", queue_name)
    async_call(probe_app,
               "probe.tasks",
               "register",
               routing_key=queue_name)
    return
コード例 #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)
コード例 #4
0
ファイル: frontendtasks.py プロジェクト: quarkslab/irma
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
               )
コード例 #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)
コード例 #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)
コード例 #7
0
ファイル: probetasks.py プロジェクト: dewiestr/irma-brain
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
コード例 #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
コード例 #9
0
ファイル: frontendtasks.py プロジェクト: deloittem/irma-brain
def scan_result(frontend_scanid, filename, probe, result):
    async_call(frontend_app,
               "frontend.tasks",
               "scan_result",
               args=[frontend_scanid, filename, probe, result])
コード例 #10
0
ファイル: frontendtasks.py プロジェクト: deloittem/irma-brain
def scan_launched(frontend_scanid, scan_request):
    async_call(frontend_app,
               "frontend.tasks",
               "scan_launched",
               args=[frontend_scanid, scan_request])
コード例 #11
0
ファイル: frontendtasks.py プロジェクト: dewiestr/irma-brain
def scan_launched(frontend_scanid):
    async_call(frontend_app, "frontend.tasks", "scan_launched", args=[frontend_scanid])