def create_trust_context(trust_id, project_id): """Creates Qinling context on behalf of the project.""" if CONF.pecan.auth_enable: client = get_trust_client(trust_id) return context.Context( user=client.user_id, tenant=project_id, auth_token=client.auth_token, is_trust_scoped=True, trust_id=trust_id, ) return context.Context(user=None, tenant=context.DEFAULT_PROJECT_ID, auth_token=None, is_admin=True)
def start_function_mapping_handler(orchestrator): tg = threadgroup.ThreadGroup(1) engine_client = rpc.get_engine_client() tg.add_timer(300, handle_function_service_expiration, ctx=context.Context(), engine_client=engine_client, orchestrator=orchestrator) _periodic_tasks[constants.PERIODIC_FUNC_MAPPING_HANDLER] = tg LOG.info('Function mapping handler started.')
def start_function_mapping_handler(engine): """Start function mapping handler thread. Function mapping handler is supposed to be running with engine service. """ tg = threadgroup.ThreadGroup(1) tg.add_timer( 300, handle_function_service_expiration, ctx=context.Context(), engine=engine, ) _periodic_tasks[constants.PERIODIC_FUNC_MAPPING_HANDLER] = tg LOG.info('Function mapping handler started.')
def start_function_mapping_handler(engine): """Start function mapping handler thread. Function mapping handler is supposed to be running with engine service. """ worker = periodics.PeriodicWorker([]) worker.add(handle_function_service_expiration, ctx=context.Context(), engine=engine) _periodic_tasks[constants.PERIODIC_FUNC_MAPPING_HANDLER] = worker thread = threading.Thread(target=worker.start) thread.setDaemon(True) thread.start() LOG.info('Function mapping handler started.')