def handle(self, addrport=f"0.0.0.0:{CLOWDER_PORT}", *args, **options): """Sources command customization point.""" timeout = 5 # Koku API server is responsible for running all database migrations. The sources client # server and kafka listener thread should only be started if migration execution is # complete. # This is a special case because check_migrations() returns three values # True means migrations are up-to-date while check_migrations() != True: # noqa LOG.warning(f"Migrations not done. Sleeping {timeout} seconds.") time.sleep(timeout) LOG.info("Starting Sources Kafka Handler") initialize_sources_integration() LOG.info("Starting Sources Client Server") if ENVIRONMENT.bool("RUN_GUNICORN", default=True): options = get_config_from_module_name("gunicorn_conf") options["bind"] = addrport SourcesApplication(application, options).run() else: from django.core.management import call_command options["use_reloader"] = False options.pop("skip_checks", None) call_command("runserver", addrport, *args, **options)
def handle(self, *args, **options): """Run our database check_migratons function.""" if check_migrations(): self.stdout.write("True") else: self.stdout.write("False")
def handle(self, *args, **kwargs): timeout = 5 while not check_migrations(): LOG.warning(f"Migrations not done. Sleeping {timeout} seconds.") time.sleep(timeout) LOG.info("Starting Sources Kafka Handler") initialize_sources_integration()
def handle(self, *args, **kwargs): """Initialize the prometheus exporter and koku-listener.""" while not check_migrations(): LOG.warning("Migrations not done. Sleeping") time.sleep(5) LOG.info("Initializing the prometheus exporter") start_http_server(CLOWDER_METRICS_PORT, registry=WORKER_REGISTRY) LOG.info("Starting Kafka handler") LOG.debug("handle args: %s, kwargs: %s", str(args), str(kwargs)) initialize_kafka_handler()
def handle(self, addrport="0.0.0.0:8080", *args, **options): """Sources command customization point.""" timeout = 5 # Koku API server is responsible for running all database migrations. The sources client # server and kafka listener thread should only be started if migration execution is # complete. while not check_migrations(): LOG.warning(f"Migrations not done. Sleeping {timeout} seconds.") time.sleep(timeout) LOG.info("Starting Sources Kafka Handler") initialize_sources_integration() LOG.info("Starting Sources Client Server") options["use_reloader"] = False call_command("runserver", addrport, *args, **options)
def handle(self, *args, **kwargs): httpd = start_probe_server(SourcesProbeServer) timeout = 5 # This is a special case because check_migrations() returns three values # True means migrations are up-to-date while check_migrations() != True: # noqa LOG.warning(f"Migrations not done. Sleeping {timeout} seconds.") time.sleep(timeout) httpd.RequestHandlerClass.ready = True # Set `ready` to true to indicate migrations are done. LOG.info("Initializing UNLEASH_CLIENT for sources-listener.") UNLEASH_CLIENT.initialize_client() LOG.info("Starting Sources Kafka Handler") initialize_sources_integration()
def handle(self, *args, **kwargs): """Initialize the prometheus exporter and koku-listener.""" httpd = start_probe_server(ListenerProbeServer) # This is a special case because check_migrations() returns three values # True means migrations are up-to-date while check_migrations() != True: # noqa LOG.warning("Migrations not done. Sleeping") time.sleep(5) httpd.RequestHandlerClass.ready = True # Set `ready` to true to indicate migrations are done. LOG.info("Initializing UNLEASH_CLIENT for masu-listener.") UNLEASH_CLIENT.initialize_client() LOG.info("Starting Kafka handler") LOG.debug("handle args: %s, kwargs: %s", str(args), str(kwargs)) initialize_kafka_handler()
def handle(self, *args, **options): """Run our database check_migratons function.""" self.stdout.write(str(check_migrations()))