From 968dbd9c0b5ea13be43522cae3a5f27341e88d29 Mon Sep 17 00:00:00 2001 From: nailixing Date: Wed, 20 May 2020 18:09:27 +0800 Subject: [PATCH] Change the predict app path to / and fix a bug in admin --- scripts/kubernetes/.env.sh | 2 +- singa_auto/admin/admin.py | 37 ++++++++++--------------------------- singa_auto/predictor/app.py | 2 +- 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/scripts/kubernetes/.env.sh b/scripts/kubernetes/.env.sh index 3c01af73..b4c0a3b5 100644 --- a/scripts/kubernetes/.env.sh +++ b/scripts/kubernetes/.env.sh @@ -31,7 +31,7 @@ export APP_SECRET=singa_auto # Core external configuration for SINGA-auto export KUBERNETES_NETWORK=singa_auto -export DOCKER_SWARM_ADVERTISE_ADDR=127.0.0.1 +export KUBERNETES_ADVERTISE_ADDR=127.0.0.1 export SINGA_AUTO_VERSION=0.2.0 export SINGA_AUTO_ADDR=127.0.0.1 export ADMIN_EXT_PORT=3000 diff --git a/singa_auto/admin/admin.py b/singa_auto/admin/admin.py index 9cfad649..ccd5d87a 100644 --- a/singa_auto/admin/admin.py +++ b/singa_auto/admin/admin.py @@ -764,7 +764,6 @@ def get_running_inference_job(self, user_id, app, app_version=-1): if inference_job is None: raise InvalidRunningInferenceJobError() - predictor_service = self._meta_store.get_service(inference_job.predictor_service_id) \ if inference_job.predictor_service_id is not None else None if self.container_model == 'K8S': @@ -776,32 +775,16 @@ def get_running_inference_job(self, user_id, app, app_version=-1): else: predictor_host = None - return { - 'id': inference_job.id, - 'status': inference_job.status, - 'train_job_id': train_job_id, - 'app': app, - 'app_version': app_version, - 'datetime_started': inference_job.datetime_started, - 'datetime_stopped': inference_job.datetime_stopped, - 'predictor_host': predictor_host - } - - def get_inference_jobs_of_app(self, user_id, app): - inference_jobs = self._meta_store.get_inference_jobs_of_app(user_id, app) - train_jobs = [self._meta_store.get_train_job(x.train_job_id) for x in inference_jobs] - return [ - { - 'id': inference_job.id, - 'status': inference_job.status, - 'train_job_id': train_job.id, - 'app': train_job.app, - 'app_version': train_job.app_version, - 'datetime_started': inference_job.datetime_started, - 'datetime_stopped': inference_job.datetime_stopped - } - for (inference_job, train_job) in zip(inference_jobs, train_jobs) - ] + return { + 'id': inference_job.id, + 'status': inference_job.status, + 'train_job_id': train_job_id, + 'app': app, + 'app_version': app_version, + 'datetime_started': inference_job.datetime_started, + 'datetime_stopped': inference_job.datetime_stopped, + 'predictor_host': predictor_host + } def get_inference_jobs_of_app(self, user_id, app): inference_jobs = self._meta_store.get_inference_jobs_of_app(user_id, app) diff --git a/singa_auto/predictor/app.py b/singa_auto/predictor/app.py index 47d409f4..1a9f80f2 100644 --- a/singa_auto/predictor/app.py +++ b/singa_auto/predictor/app.py @@ -47,7 +47,7 @@ def index(): return 'Predictor is up.' -@app.route('/predict', methods=['POST']) +@app.route('/', methods=['POST']) def predict(): if request.files.getlist('img'):