Skip to content

Commit

Permalink
fix: try catch for status update post
Browse files Browse the repository at this point in the history
Co-authored-by: Nightknight3000 <[email protected]>
  • Loading branch information
antidodo and Nightknight3000 committed Nov 7, 2024
1 parent 03a5e86 commit 65202c6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/status/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,17 @@ def _submit_analysis_status_update(node_analysis_id: str, status: AnalysisHubSta
:return:
"""
if status is not None:

response = asyncio.run(AsyncClient(base_url=os.getenv('HUB_URL_CORE'),
headers={"accept": "application/json",
"Authorization":f"Bearer {get_hub_token()['hub_token']}"})
.post(f'/analysis-nodes/{node_analysis_id}',
json={"run_status": status},
headers=[('Connection', 'close')]))
print(f"resposne status update: {response.json()}")
response.raise_for_status()

try:
response = asyncio.run(AsyncClient(base_url=os.getenv('HUB_URL_CORE'),
headers={"accept": "application/json",
"Authorization":f"Bearer {get_hub_token()['hub_token']}"})
.post(f'/analysis-nodes/{node_analysis_id}',
json={"run_status": status},
headers=[('Connection', 'close')]))
#print(f"resposne status update: {response.json()}")
response.raise_for_status()
except httpx.HTTPStatusError as e:
print(f"Error updating analysis status: {e}")

def _get_node_analysis_id(node_id: str, analysis_id: str) -> str:
"""
Expand Down

0 comments on commit 65202c6

Please sign in to comment.