fix: fail fast bad executor

This commit is contained in:
Florian Hönicke
2023-04-25 15:15:50 +02:00
parent f9371458e5
commit 4164faf415
3 changed files with 22 additions and 2 deletions

View File

@@ -131,6 +131,14 @@ def _push_executor(dir_path):
responses.append(d)
return '\n'.join(responses)
def is_microservice_in_hub(microservice_name):
url = f'https://api.hubble.jina.ai/v2/rpc/executor.list?search={microservice_name}&withAnonymous=true'
resp = requests.get(url)
executor_list = resp.json()['data']
for executor in executor_list:
if 'name' in executor and executor['name'] == microservice_name:
return True
return False
def get_user_name(token=None):
client = hubble.Client(max_retries=None, jsonify=True, token=token)

View File

@@ -205,8 +205,14 @@ metas:
if i == MAX_DEBUGGING_ITERATIONS - 1:
raise self.MaxDebugTimeReachedException('Could not debug the microservice.')
else:
print('Successfully build microservice.')
break
# at the moment, there can be cases where no error log is extracted but the executor is still not published
# it leads to problems later on when someone tries a run or deployment
if is_microservice_in_hub(microservice_name):
print('Successfully build microservice.')
break
else:
raise Exception(log_hubble)
return get_microservice_path(path, microservice_name, packages, num_approach, i)