def __init__(self, config, stats_client=None): super(TeethAgentAPI, self).__init__() self.config = config self.stats_client = stats_client or stats.get_stats_client( config, prefix='agent_api') self.network_provider = networks_base.get_network_provider(config)
def __init__(self, config, job_client=None, stats_client=None): super(TeethPublicAPI, self).__init__() self.config = config self.job_client = job_client or jobs_base.JobClient(config) self.stats_client = stats_client or stats.get_stats_client( config, prefix='api') self.image_provider = images_base.get_image_provider(config) self.network_provider = networks_base.get_network_provider(config)
def __init__(self, config): super(JobExecutor, self).__init__(config) self.config = config self.log = structlog.get_logger() self.agent_client = agent_client.get_agent_client(config) self.interval_timer = util.IntervalTimer(BASE_POLLING_INTERVAL, MAX_POLLING_INTERVAL) self.job_client = JobClient(config) self.image_provider = images_base.get_image_provider(config) self.oob_provider = oob_base.get_oob_provider(config) self.network_provider = networks_base.get_network_provider(config) self.scheduler = scheduler.TeethInstanceScheduler() self.claim_lock = threading.Lock() self.queue = marconi.MarconiClient(base_url=config.MARCONI_URL) self.stats_client = stats.get_stats_client(config, 'jobs') self.concurrent_jobs_gauge = stats.ConcurrencyGauge(self.stats_client, 'concurrent_jobs') self._job_type_cache = {}
def test_get_stats_client_with_prefix(self): client = stats.get_stats_client(self.config, prefix='api') self.assertEqual(client._prefix, 'teeth.api')
def test_get_stats_client_with_no_prefix(self): client = stats.get_stats_client(self.config) self.assertEqual(client._prefix, 'teeth')