def setup_query(liveaction_id, runnertype_db, query_context): if not getattr(runnertype_db, 'query_module', None): raise Exception('The runner "%s" does not have a query module.' % runnertype_db.name) state_db = ActionExecutionStateDB(execution_id=liveaction_id, query_module=runnertype_db.query_module, query_context=query_context) ActionExecutionState.add_or_update(state_db)
def _create_execution_state(self, liveaction_id, runnertype_db, query_context): state_db = ActionExecutionStateDB( execution_id=liveaction_id, query_module=runnertype_db.query_module, query_context=query_context) try: return ActionExecutionState.add_or_update(state_db) except: LOG.exception('Unable to create execution state db for liveaction_id %s.' % liveaction_id) return None
def _create_save_actionstate(): created = ActionExecutionStateDB() created.query_context = {'id': 'some_external_service_id'} created.query_module = 'dummy.modules.query1' created.execution_id = bson.ObjectId() return ActionExecutionState.add_or_update(created)
def get_state(cls, exec_db): state = ActionExecutionStateDB(execution_id=str(exec_db.id), query_context={'id': 'foo'}, query_module='test_querymodule') return ActionExecutionState.add_or_update(state)