def testCallback(self) -> None: publisher = NoopPublisher() callback = MagicMock() publisher.register_call_back(callback) publisher.publish() self.assertTrue(callback.on_success.called)
def __init__(self, conf, task, publisher=NoopPublisher()): # type: (ConfigTree, Task, Publisher) -> None self.task = task self.conf = conf self.publisher = publisher self.scoped_conf = Scoped.get_scoped_conf(self.conf, self.get_scope()) if self.scoped_conf.get_bool(DefaultJob.IS_STATSD_ENABLED, False): prefix = 'amundsen.databuilder.job.{}'.format( self.scoped_conf.get_string(DefaultJob.JOB_IDENTIFIER)) LOGGER.info( 'Setting statsd for job metrics with prefix: {}'.format( prefix)) self.statsd = StatsClient(prefix=prefix) else: self.statsd = None
def __init__( self, conf: ConfigTree, task: Task = None, publisher: Publisher = NoopPublisher()) -> None: self.task = task self.conf = conf self.publisher = publisher self.scoped_conf = Scoped.get_scoped_conf(self.conf, self.get_scope()) if self.scoped_conf.get_bool(CustomizedJob.IS_STATSD_ENABLED, False): prefix = f'amundsen.databuilder.job.{self.scoped_conf.get_string(CustomizedJob.JOB_IDENTIFIER)}' LOGGER.info('Setting statsd for job metrics with prefix: %s', prefix) self.statsd = StatsClient(prefix=prefix) else: self.statsd = None