Skip to content

Commit

Permalink
fix: fix missing secret when logged-in user with --force-update and … (
Browse files Browse the repository at this point in the history
  • Loading branch information
floralatin committed Sep 20, 2022
1 parent 8c2d075 commit caf4a3d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions jina/hubble/hubio.py
Expand Up @@ -364,8 +364,6 @@ def _async_push(
content,
form_data,
work_path,
uuid8,
secret,
task_id,
):

Expand All @@ -377,11 +375,9 @@ def _async_push(

if image:
new_uuid8 = image['id']
new_secret = image.get('secret')
form_data['id'] = new_uuid8

if new_uuid8 != uuid8 or new_secret != secret:
dump_secret(work_path, new_uuid8, new_secret or '', task_id)
dump_secret(work_path, new_uuid8, form_data.get('secret'), task_id)
else:
raise Exception(f'Unknown Error, session_id: {session_id}')

Expand Down Expand Up @@ -415,16 +411,17 @@ def _async_push(
new_task_id = push_task.get('_id')
if new_task_id:

dump_secret(work_path, None, None, new_task_id)
dump_secret(work_path, form_data.get('id'), form_data.get('secret'), new_task_id)
self._prettyprint_status_usage(console, work_path, new_task_id)
st.update(f'Async Uploaded!')

image = self._status_with_progress(console, st, new_task_id, False, verbose)
if image:
new_uuid8, new_secret = self._prettyprint_result(console, image)

if new_uuid8 != uuid8 or new_secret != secret or task_id != new_task_id:
dump_secret(work_path, new_uuid8, new_secret or '', new_task_id)
# `new_secret` is always None
new_uuid8, new_secret = self._prettyprint_result(console, image)
if new_uuid8 != form_data.get('id'):
dump_secret(work_path, new_uuid8, form_data.get('secret'), new_task_id)

else:
raise Exception(f'Unknown Error, session_id: {session_id}')
Expand Down Expand Up @@ -637,8 +634,6 @@ def push(self) -> None:
content,
form_data,
work_path,
uuid8,
secret,
task_id,
)

Expand Down Expand Up @@ -857,9 +852,11 @@ def _status_with_progress(self, console, st, task_id, replay=False, verbose=Fals
st.update(f'Cloud pending ... [dim]: {t} ({status})[/dim]')

elif status == 'failed':
error = stream_msg.get('message')
error = stream_msg.get('error', {})
msg = error.get('message')
message = stream_msg.get('message')
raise Exception(
f'{ error or "Unknown Error"} session_id: {session_id}'
f'{ msg or message or "Unknown Error"} session_id: {session_id}'
)

elif status == 'waiting':
Expand Down

0 comments on commit caf4a3d

Please sign in to comment.