Browse Source

!989 update mindinsight settings in stop script

From: @liangyongxiong1024
Reviewed-by: @wenkai_dist,@lilongfei15
Signed-off-by: @lilongfei15
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
2f116ab232
2 changed files with 7 additions and 14 deletions
  1. +0
    -10
      mindinsight/conf/__init__.py
  2. +7
    -4
      mindinsight/scripts/stop.py

+ 0
- 10
mindinsight/conf/__init__.py View File

@@ -110,16 +110,6 @@ class Settings:
setattr(self, setting, value)
self._explicit_settings.add(setting)

def config_workspace(self, workspace):
"""
Config workspace value.

Args:
workspace (str): Path of workspace.
"""
setattr(self, 'WORKSPACE', workspace)
self._explicit_settings.add('WORKSPACE')

def is_overridden(self, setting_name):
"""
Check if specified setting is overridden.


+ 7
- 4
mindinsight/scripts/stop.py View File

@@ -56,7 +56,6 @@ class Command(BaseCommand):
description = 'stop mindinsight service'

cmd_regex = 'mindinsight.backend.application:APP'
access_log_path = os.path.join('gunicorn', 'access.{}.log'.format(settings.PORT))

def add_arguments(self, parser):
"""
@@ -84,9 +83,12 @@ class Command(BaseCommand):
args.port = settings.PORT

pid, workspace = self.get_process(args.port)
settings.config_workspace(workspace)
setattr(args, 'pid', pid)

os.environ['MINDINSIGHT_PORT'] = str(args.port)
os.environ['MINDINSIGHT_WORKSPACE'] = workspace
settings.refresh()

def run(self, args):
"""
Run to stop.
@@ -164,9 +166,10 @@ class Command(BaseCommand):

pid = gunicorn_master_process.pid

access_log_path = os.path.join('gunicorn', 'access.{}.log'.format(port))
for open_file in process.open_files():
if open_file.path.endswith(self.access_log_path):
log_base_dir = open_file.path[:-len(self.access_log_path)]
if open_file.path.endswith(access_log_path):
log_base_dir = open_file.path[:-len(access_log_path)]
workspace = os.path.realpath(os.path.join(log_base_dir, os.pardir))
break
break


Loading…
Cancel
Save