microsoft / AIforEarth-API-Development

This is an API Framework for AI models to be hosted locally or on the AI for Earth API Platform (https://github.com/microsoft/AIforEarth-API-Platform).
MIT License
75 stars 44 forks source link

Error in api_task_manager.UpdateTaskStatus when there's an exception in provided functions #62

Closed yangsiyu007 closed 4 years ago

yangsiyu007 commented 5 years ago

There was an exception in my part of the app (making an async API), but the error was not propagated it seems, and subsequent calls to the /task endpoint still shows the job as "created":

{
    "uuid": 6061,
    "status": "created",
    "timestamp": "2019-08-08 01:00:46",
    "endpoint": "uri"
}

From the local log, the issue is

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/envs/ai4e_py_api/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/envs/ai4e_py_api/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/app/orchestrator_api/runserver.py", line 290, in _request_detections
    api_task_manager.UpdateTaskStatus(request_id,
UnboundLocalError: local variable 'request_id' referenced before assignment

Expected behavior: task status reflects the error in the custom code.