Esempio n. 1
0
def then_verify_job_with_var_id(context, var_jobid,var_task_type,var_wait):
    jid = context.alienvault.get (var_jobid)
    assert jid != None, "Bad job_id %s" % var_jobid
    # This is a celery.events.Event
    #wait 
    time.sleep(float(var_wait))
    ev = CeleryManager.get_job_status (jid)
    assert ev !=None, "No status for task %s in celery_job"
    assert ev['type'] == var_task_type, "Bad type  for task id: %s  Real: %s Must be:%s" % (var_jobid,ev['type'],var_task_type)
Esempio n. 2
0
def then_verify_job_with_var_id(context, var_jobid, var_task_type, var_wait):
    jid = context.alienvault.get(var_jobid)
    assert jid != None, "Bad job_id %s" % var_jobid
    # This is a celery.events.Event
    #wait
    time.sleep(float(var_wait))
    ev = CeleryManager.get_job_status(jid)
    assert ev != None, "No status for task %s in celery_job"
    assert ev[
        'type'] == var_task_type, "Bad type  for task id: %s  Real: %s Must be:%s" % (
            var_jobid, ev['type'], var_task_type)
Esempio n. 3
0
def then_get_jobid_result (context,var_jobid):
    ev = CeleryManager.get_job_status (context.alienvault[var_jobid])
Esempio n. 4
0
# SetUP the library
API_i18n = AlienvaultMessageHandler
(success, msg) = API_i18n.setup("alienvault_api", os.path.dirname(os.path.abspath(__file__)) + "/api_i18n/locales/",
                                AlienvaultApps.API, i18nmsgs.api_messages)
if not success:
    app.logger.warning("Error handler can't be installed: %s" % (msg))



db=SQLAlchemy(app, session_options={'autocommit': True})

login_manager = LoginManager(app)
principals = Principal(app)

# Use nice error handlers for all common HTTP codes.
use_pretty_default_error_handlers(app)

from celerymethods.celery_manager import CeleryManager
cm = CeleryManager()
cm.start()

# This is the recommended way of packaging a Flask app.
# This seems to be a hack to avoid circulat imports.
# See http://flask.pocoo.org/docs/patterns/packages/
import api.views

# (Keep pyflakes quiet)
api.views

login_manager.login_view = "auth.login"
Esempio n. 5
0
def then_get_jobid_result(context, var_jobid):
    ev = CeleryManager.get_job_status(context.alienvault[var_jobid])