Skip to content

Commit

Permalink
Make stop_inference_job api work for the job created by checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nailixing committed Jun 2, 2020
1 parent 778bc85 commit 54fb7d8
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions singa_auto/admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,17 +716,26 @@ def create_inference_job(self, user_id, app, app_version, budget):
def stop_inference_job(self, user_id, app, app_version=-1):
train_job = self._meta_store.get_train_job_by_app_version(
user_id, app, app_version=app_version)

# if there is no train job
if train_job is None:
# TODO: REST api need to return some JSON, and not
# just raise errors!!
raise InvalidRunningInferenceJobError()

inference_job = self._meta_store.get_deployed_inference_job_by_train_job(
train_job.id)
if inference_job is None:
# TODO: REST api need to return some JSON, and not
# just raise errors!!
raise InvalidRunningInferenceJobError()
# check if the inference job is created by model checkpoint
model = self._meta_store.get_model_by_name(user_id=user_id, name=app)

# if the given model dont have checkpoint
if model.checkpoint_id is None:
raise InvalidRunningInferenceJobError('Have you start a train job or uploaded a checkpoint file for {}?'
.format(app))
else:

inference_job = self._meta_store.get_deployed_inference_job_by_model_id(model.id)
else:
# if there is train job
inference_job = self._meta_store.get_deployed_inference_job_by_train_job(
train_job.id)
if inference_job is None:
raise InvalidRunningInferenceJobError("No inference related to this app")

inference_job = self._services_manager.stop_inference_services(
inference_job.id)
Expand Down

0 comments on commit 54fb7d8

Please sign in to comment.