def main(): format = '%(asctime)s %(levelname)-8s %(name)s: %(message)s' logging.basicConfig(level=logging.DEBUG, format=format) requests_log = logging.getLogger("requests") requests_log.setLevel(logging.WARNING) formation = os.getenv('GILLIAM_FORMATION') instance = os.getenv('GILLIAM_INSTANCE') srnodes = os.getenv('GILLIAM_SERVICE_REGISTRY_NODES') check_interval = int(os.getenv('CHECK_INTERVAL', 10)) store_client = etcd.Etcd(host='_store.%s.service' % (formation,)) store_command = store.InstanceStoreCommand(store_client) store_query = store.InstanceStoreQuery(store_client, store_command) registry_client = ServiceRegistryClient(time, srnodes.split(',')) executor_manager = ExecutorManager(time, registry_client, store_query, check_interval) policy = RequirementRankPlacementPolicy() services = [ Scheduler(time, store_query, executor_manager, policy), Updater(time, store_query, executor_manager), Terminator(time, store_query, executor_manager) ] leader_lock = util.Lock(store_client, 'leader', instance) with leader_lock: store_query.start() executor_manager.start() for service in services: service.start() _worker(executor_manager, store_query)
def main(): parser = OptionParser() parser.add_option("-s", "--service-registry", dest="service_registry", default=os.getenv('GILLIAM_SERVICE_REGISTRY', ''), help="service registry nodes", metavar="HOSTS") (options, args) = parser.parse_args() format = '%(asctime)s %(levelname)-8s %(name)s: %(message)s' logging.basicConfig(level=logging.DEBUG, format=format) formation = os.getenv('GILLIAM_FORMATION', 'scheduler') store_client = etcd.Etcd(host='_store.%s.service' % (formation, ), autostart=False) store_command = store.InstanceStoreCommand(store_client) store_query = store.InstanceStoreQuery(store_client, store_command) release_store = ReleaseStore(store_client) registry_client = ServiceRegistryClient( time, options.service_registry.split(',')) executor_manager = ExecutorManager(time, registry_client, store_query, 5) executor_manager.start() _bootstrap0(registry_client, executor_manager, store_client, store_command, release_store, formation)
def main(): parser = OptionParser() parser.add_option("-s", "--service-registry", dest="service_registry", default=os.getenv('GILLIAM_SERVICE_REGISTRY', ''), help="service registry nodes", metavar="HOSTS") (options, args) = parser.parse_args() format = '%(asctime)s %(levelname)-8s %(name)s: %(message)s' logging.basicConfig(level=logging.DEBUG, format=format) formation = os.getenv('GILLIAM_FORMATION', 'scheduler') store_client = etcd.Etcd(host='_store.%s.service' % (formation,), autostart=False) store_command = store.InstanceStoreCommand(store_client) store_query = store.InstanceStoreQuery(store_client, store_command) release_store = ReleaseStore(store_client) registry_client = ServiceRegistryClient(time, options.service_registry.split(',')) executor_manager = ExecutorManager(time, registry_client, store_query, 5) executor_manager.start() _bootstrap0(registry_client, executor_manager, store_client, store_command, release_store, formation)