def exec_start_cmd(args): """Submit an execution.""" app_descr = json.load(args.jsonfile) app_validate(app_descr) exec_api = ZoeExecutionsAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass()) ret = exec_api.start(args.name, app_descr) print("Application scheduled successfully with ID {}, use the exec-get command to check its status".format(ret))
def app_validate_cmd(args): app_descr = json.load(args.jsonfile) try: app_validate(app_descr) except InvalidApplicationDescription as e: print(e) else: print("Static validation OK")
def app_validate_cmd(api_: ZoeAPI, args): """Validate an application description.""" app_descr = json.load(args.jsonfile) try: app_validate(app_descr) except InvalidApplicationDescription as e: print(e) else: print("Static validation OK")
def exec_start_cmd(args): """Submit an execution.""" app_descr = json.load(args.jsonfile) app_validate(app_descr) exec_api = ZoeExecutionsAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass()) exec_id = exec_api.start(args.name, app_descr) if not args.synchronous: print("Application scheduled successfully with ID {}, use the exec-get command to check its status".format(exec_id)) else: print("Application scheduled successfully with ID {}, waiting for status change".format(exec_id)) old_status = 'submitted' while True: execution = exec_api.get(exec_id) current_status = execution['status'] if old_status != current_status: print('Execution is now {}'.format(current_status)) old_status = current_status if current_status == 'running': break time.sleep(1) monitor_service_id = None service_api = ZoeServiceAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass()) for service_id in execution['services']: service = service_api.get(service_id) if service['description']['monitor']: monitor_service_id = service['id'] break print('\n>------ start of log streaming -------<\n') why_stop = _log_stream_stdout(monitor_service_id, False) print('\n>------ end of log streaming -------<\n') if why_stop == 'stream_end': print('Execution finished') exit(0) elif why_stop == 'interrupt': print('Do not worry, your execution ({}) is still running.'.format(exec_id)) exit(1)
def test_from_dict(application_dict): assert isinstance(application_dict, dict) app_validate(application_dict)
def exec_start_cmd(args): app_descr = json.load(args.jsonfile) app_validate(app_descr) exec_api = ZoeExecutionsAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass()) ret = exec_api.execution_start(args.name, app_descr) print("Application scheduled successfully with ID {}, use the exec-get command to check its status".format(ret))
def test_fails_for_zapp(self): """Test validation of port number.""" bad_fp = open('/dev/random', 'r') with pytest.raises(applications.InvalidApplicationDescription): applications.app_validate(bad_fp)
def test_pass_for_complex_zapp(self): """Test zapp validation code.""" zapp_fp = json.load(open('integration_tests/complex_zapp.json', 'r')) applications.app_validate(zapp_fp)