예제 #1
0
def register():
    routing_key = current_task.request.delivery_info['routing_key']
    probe = probes[routing_key]
    probe_name = type(probe).plugin_name
    probe_category = type(probe).plugin_category
    probe_regexp = type(probe).plugin_mimetype_regexp
    register_probe(probe_name, probe_category, probe_regexp)
예제 #2
0
 def test_register_probe(self, m_async_call):
     module.register_probe("name", "displayname", "category",
                           "mimetype_regexp")
     m_async_call.assert_called_with(
         module.brain_app,
         'brain.scan_tasks',
         'register_probe',
         args=['name', 'displayname', 'category', 'mimetype_regexp'])
예제 #3
0
 def test_register_probe(self, m_async_call):
     module.register_probe("name", "displayname", "category",
                           "mimetype_regexp")
     m_async_call.assert_called_with(module.brain_app,
                                     'brain.scan_tasks',
                                     'register_probe',
                                     args=['name',
                                           'displayname',
                                           'category',
                                           'mimetype_regexp'])
예제 #4
0
파일: tasks.py 프로젝트: vaginessa/irma
def register():
    routing_key = current_task.request.delivery_info['routing_key']
    probe = probes[routing_key]
    probe_name = type(probe).plugin_name
    probe_display_name = type(probe).plugin_display_name
    probe_category = type(probe).plugin_category
    probe_regexp = type(probe).plugin_mimetype_regexp
    log.debug("queue %s probe %s category %s probe_regexp %s",
              probe_name, probe_display_name, probe_category, probe_regexp)
    register_probe(probe_name, probe_display_name,
                   probe_category, probe_regexp)
예제 #5
0
파일: tasks.py 프로젝트: quarkslab/irma
def register():
    routing_key = current_task.request.delivery_info['routing_key']
    probe = probes[routing_key]
    probe_name = type(probe).plugin_name
    probe_display_name = type(probe).plugin_display_name
    probe_category = type(probe).plugin_category
    probe_regexp = type(probe).plugin_mimetype_regexp
    log.debug("queue %s probe %s category %s probe_regexp %s",
              probe_name, probe_display_name, probe_category, probe_regexp)
    register_probe(probe_name, probe_display_name,
                   probe_category, probe_regexp)
예제 #6
0
파일: tasks.py 프로젝트: vaginessa/irma
    queues.append(kombu.Queue(probe_name, routing_key=probe_name))

log.info('Configure Queues')
# update configuration
probe_app.conf.update(
    CELERY_QUEUES=tuple(queues),
)

for p in probes:
    # register probe on Brain
    log.info('Register probe %s' % p.plugin_name)
    delay = 1
    while True:
        try:
            task = register_probe(p.plugin_name,
                                  p.plugin_display_name,
                                  p.plugin_category,
                                  p.plugin_mimetype_regexp)
            task.get(timeout=10)
            break
        except (TimeoutError, IrmaTaskError):
            log.error("Registering on brain failed retry in %s seconds...",
                      delay)
            time.sleep(delay)
            delay = min([2*delay, RETRY_MAX_DELAY])
            pass

# instantiation of probes and queue creation
probes = dict((probe.plugin_name, probe()) for probe in probes)


##############################################################################
예제 #7
0
파일: tasks.py 프로젝트: quarkslab/irma
                              queue_arguments=probe_queues_options))

log.info('Configure Queues')
# update configuration
probe_app.conf.update(
    CELERY_QUEUES=tuple(queues),
)

for p in probes:
    # register probe on Brain
    log.info('Register probe %s' % p.plugin_name)
    delay = 1
    while True:
        try:
            task = register_probe(p.plugin_name,
                                  p.plugin_display_name,
                                  p.plugin_category,
                                  p.plugin_mimetype_regexp)
            task.get(timeout=10)
            break
        except (TimeoutError, IrmaTaskError):
            log.error("Registering on brain failed retry in %s seconds...",
                      delay)
            time.sleep(delay)
            delay = min([2*delay, RETRY_MAX_DELAY])
            pass

# instantiation of probes and queue creation
probes = dict((probe.plugin_name, probe()) for probe in probes)


##############################################################################
예제 #8
0
# update configuration
probe_app.conf.update(
    CELERY_QUEUES=tuple(queues),
)

for p in probes:
    # register probe on Brain
    probe_name = p.plugin_name
    probe_category = p.plugin_category
    mimetype_regexp = p.plugin_mimetype_regexp
    log.info('Register probe %s' % probe_name)
    try_nb = 1
    while True:
        try:
            try_nb += 1
            task = register_probe(probe_name, probe_category, mimetype_regexp)
            task.get(timeout=10)
            break
        except TimeoutError:
            log.info("Registering on brain try %s", format(try_nb))
            pass

# instanciation of probes and queue creation
probes = dict((probe.plugin_name, probe()) for probe in probes)


##############################################################################
# declare celery tasks
##############################################################################

def handle_output_files(results, dstpath):