def maybe_do_deployment_stuff(): if args.deploy: try: dl.packages.get('zazuml').delete() except: pass with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp)['project'] maybe_login() project = dl.projects.get(project_name=global_project_name) package_obj = push_package(project) try: trial_service = deploy_model(package=package_obj, service_name='trial') trainer_service = deploy_model(package=package_obj, service_name='trainer') zazu_service = deploy_zazu(package=package_obj) except: trial_service.delete() trainer_service.delete() zazu_service.delete() if args.update: with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp) maybe_login() project = dl.projects.get(project_name=global_project_name) update_service(project, 'trial') update_service(project, 'trainer') update_service(project, 'zazu')
def maybe_do_deployment_stuff(): if args.deploy: with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp)['project'] global_project = dl.projects.get(project_name=global_project_name) global_package_obj = push_package(global_project) try: # predict_service = deploy_predict(package=global_package_obj) trial_service = deploy_model(package=global_package_obj) zazu_service = deploy_zazu(package=global_package_obj) except: # predict_service.delete() trial_service.delete() zazu_service.delete() elif args.zazu_timer: with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp)['project'] global_project = dl.projects.get(project_name=global_project_name) global_package_obj = push_package(global_project) with open('configs.json', 'r') as fp: configs = json.load(fp) configs_input = dl.FunctionIO(type='Json', name='configs', value=configs) time_input = dl.FunctionIO(type='Json', name='time', value=3600) deploy_zazu_timer(package=global_package_obj, configs=configs_input, time=time_input, test_dataset=test_dataset_input, query=query_input) if args.update: with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp) maybe_login() global_project = dl.projects.get(project_name=global_project_name) update_service(global_project, 'trial') update_service(global_project, 'zazu')
def maybe_do_deployment_stuff(): if args.deploy: logger.info('about to launch 2 deployments, zazu and trial') with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp)['project'] global_project = dl.projects.get(project_name=global_project_name) global_package_obj = push_package(global_project) try: # predict_service = deploy_predict(package=global_package_obj) trial_service = deploy_model(package=global_package_obj) zazu_service = deploy_zazu(package=global_package_obj) logger.info('deployments launched successfully') except: # predict_service.delete() trial_service.delete() zazu_service.delete() if args.zazu_timer: logger.info('about to launch timer deployment') with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp)['project'] global_project = dl.projects.get(project_name=global_project_name) global_package_obj = push_package(global_project) with open('configs.json', 'r') as fp: configs = json.load(fp) configs_input = dl.FunctionIO(type='Json', name='configs', value=json.dumps(configs)) time_input = dl.FunctionIO(type='Json', name='time', value=3600*0.25) test_dataset_input = dl.FunctionIO(type='Json', name='test_dataset_id', value='5eb7e0bdd4eb9434c77d80b5') query_input = dl.FunctionIO(type='Json', name='query', value=json.dumps({"resource": "items", "sort": {}, "page": 0, "pageSize": 1000, "filter": {"$and": [{"dir": "/items/val*"}, {"hidden": False}, {"type": "file"}]}})) init_inputs = [configs_input, time_input, test_dataset_input, query_input] deploy_zazu_timer(package=global_package_obj, init_inputs=init_inputs) logger.info('timer deployment launched successfully') if args.update: with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp) maybe_login() global_project = dl.projects.get(project_name=global_project_name) update_service(global_project, 'trial') update_service(global_project, 'zazu')
def do_deployment_stuff(model_id, checkpoint_id): with open('global_configs.json', 'r') as fp: global_project_name = json.load(fp)['project'] global_project = dl.projects.get(project_name=global_project_name) package_obj = push_package(global_project) logger.info('package pushed') try: deploy_predict_item(package=package_obj, model_id=model_id, checkpoint_id=checkpoint_id) logger.info('service deployed') except: pass