def get_context(): return json.dumps({ "references": data_handler.get_references(), "datasets": get_content(data_handler.datasets.all()), "services": list( map(lambda Service: Service.frontend_information(), get_services())), "experiments": get_content(data_handler.experiments.all()) })
def __init__(self, data_handler, data_directory, constants): self.data_handler = data_handler self.experiment_statuses = constants["experiment"] self.docker_client = Docker(data_directory) self.tasks = [] self.current_task = None self.services = get_services() self.scheduler = BackgroundScheduler() self.scheduler.add_job(func=self.check_run, trigger="interval", seconds=5, timezone="Europe/Berlin") self.scheduler.start() logging.getLogger('apscheduler').setLevel("ERROR")
def start_node(config: dict): import services services = services.get_services() logger = get_logger("Node_" + str(uuid.uuid4())) loop = asyncio.new_event_loop() async def run(config): await asyncio.gather( call_service(nats_host=config.get('nats_host'), nats_port=config.get('nats_port'), service_topic=config.get('service_topic'), response_topic=config.get('response_topic'), loop=loop, logger=logger, services=services), synchronize(services, logger)) loop.run_until_complete(run(config)) loop.run_forever()
import os import sys import bonobo import bonobo_sqlalchemy from bonobo.config import use_context @use_context def extract(context): context.set_output_fields(['id', 'value']) for i in range(1000): yield i, 'value for {}'.format(i) def get_graph(**options): graph = bonobo.Graph() graph.add_chain(extract, bonobo_sqlalchemy.InsertOrUpdate('example')) return graph # The __main__ block actually execute the graph. if __name__ == '__main__': sys.path.append(os.path.dirname(__file__)) import commands, services with commands.parse_args() as options: bonobo.run(get_graph(**options), services=services.get_services())
def configurate_extension(self): from services import get_services for view, urls in get_services(): self.extension.add_resource(view, urls)
def get_aligner_soft_clips(self): aligner_id = self.content["pipeline"]["alignment"]["id"] aligner = next(service for service in get_services() if service.id == aligner_id) return aligner.soft_clips_exist
def main(): bonobo.run(get_graph(), services=services.get_services())
if __name__ == "__main__": # Initialize API config.load_kube_config() api = client.CoreV1Api() beta_api = client.ExtensionsV1beta1Api() print("\n\nDelete all deployments in default namespace") deployments_list = deployments.get_deployments(beta_api) for deployment in deployments_list: if deployments.namespace(deployment) == 'default': deployments.delete_deployment(beta_api, deployment) print("\n\nDelete all services in default namespace") services_list = services.get_services(api) for service in services_list: if services.namespace(service) == 'default' and services.name( service) != 'kubernetes': services.delete_service(api, service) print("\n\nDelete all pods in default namespace") pods_list = pods.get_pods_list(api) for pod in pods_list: if pods.namespace(pod) == 'default': pods.delete_pod(api, pod) pods_deleted = check_empty_namespace(api, 'default') if pods_deleted: print("All pods in default namespace successfully deleted") else: