def setUp(self): self.req = MagicMock() self.resp = MagicMock() self.db_handler = MagicMock() self.resource = WorkersStatusResource(self.db_handler) self.registration = WorkerRegistration('worker').format() self.worker = Worker(**self.registration) self.worker_dict = Worker(**self.registration).format()
def setUp(self): self.req = MagicMock() self.resp = MagicMock() self.hostname = 'worker01' self.resource = WorkersStatusResource() self.worker = Worker(_id='010101', hostname=self.hostname, ip_address_v4='172.23.1.100', ip_address_v6='::1', personality='worker01', status='online', system_info={})
def start_up(): #Common Resource(s) versions = VersionResource() #Datastore adapter/session manager datastore = datasource_handler(COORDINATOR_DB) #Coordinator Resources worker_registration = WorkerRegistrationResource(datastore) workers_status = WorkersStatusResource(datastore) worker_status = WorkerStatusResource(datastore) #Tenant Resources tenant = TenantResource(datastore) user = UserResource(datastore) event_producers = EventProducersResource(datastore) event_producer = EventProducerResource(datastore) token = TokenResource(datastore) # Create API application = api = falcon.API() # Common Routing api.add_route('/', versions) # Coordinator Routing api.add_route('/v1/pairing', worker_registration) api.add_route('/v1/worker/{worker_id}/status', worker_status) api.add_route('/v1/status', workers_status) # Tenant Routing api.add_route('/v1/tenant', tenant) api.add_route('/v1/tenant/{tenant_id}', user) api.add_route('/v1/tenant/{tenant_id}/producers', event_producers) api.add_route('/v1/tenant/{tenant_id}/producers/{event_producer_id}', event_producer) api.add_route('/v1/tenant/{tenant_id}/token', token) return application
def start_up(): #Common Resource(s) versions = VersionResource() #Coordinator Resources workers_status = WorkersStatusResource() worker_status = WorkerStatusResource() #Tenant Resources tenant = TenantResource() user = UserResource() event_producers = EventProducersResource() event_producer = EventProducerResource() token = TokenResource() # Create API application = api = falcon.API() # Common Routing api.add_route('/', versions) api.add_route('/v1/worker/{hostname}/status', worker_status) api.add_route('/v1/status', workers_status) # Tenant Routing api.add_route('/v1/tenant', tenant) api.add_route('/v1/tenant/{tenant_id}', user) api.add_route('/v1/tenant/{tenant_id}/producers', event_producers) api.add_route('/v1/tenant/{tenant_id}/producers/{event_producer_id}', event_producer) api.add_route('/v1/tenant/{tenant_id}/token', token) celery_proc = Process(target=celery.worker_main) celery_proc.start() _LOG.info('Celery started as process: {}'.format(celery_proc.pid)) return application
from meniscus.api.version.resources import VersionResource from meniscus.data.datastore import COORDINATOR_DB, datasource_handler from meniscus import env from meniscus.openstack.common import log log.setup('meniscus') _LOG = env.get_logger(__name__) #Common Resource(s) versions = VersionResource() #Coordinator Resources db_handler = datasource_handler(COORDINATOR_DB) worker_registration = WorkerRegistrationResource(db_handler) workers_status = WorkersStatusResource(db_handler) worker_status = WorkerStatusResource(db_handler) #Tenant Resources tenant = TenantResource(db_handler) user = UserResource(db_handler) event_producers = EventProducersResource(db_handler) event_producer = EventProducerResource(db_handler) token = TokenResource(db_handler) # Create API application = api = falcon.API() # Common Routing api.add_route('/', versions)