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='tests.resources.test_querymodule') return ActionExecutionState.add_or_update(state)