Skip to content

Commit

Permalink
add try and except to um.py
Browse files Browse the repository at this point in the history
  • Loading branch information
monabraeunig authored Nov 13, 2024
1 parent 660d146 commit b50118b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions umbridge/um.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ async def evaluate(request):
if len(parameters[i]) != input_sizes[i]:
return error_response("InvalidInput", f"Input parameter {i} has invalid length! Expected {input_sizes[i]} but got {len(parameters[i])}.", 400)

output_future = model_executor.submit(model.__call__, parameters, config)
output = await asyncio.wrap_future(output_future)
try:
output_future = model_executor.submit(model.__call__, parameters, config)
output = await asyncio.wrap_future(output_future)
except Exception as e:
print(f"An error occured during the evaluation: {e}")

# Check if output is a list of lists
if not isinstance(output, list):
Expand Down

0 comments on commit b50118b

Please sign in to comment.