diff --git core/server/clean.py core/server/clean.py index 25cb323..44f7406 100644 --- core/server/clean.py +++ core/server/clean.py @@ -21,23 +21,19 @@ from calculate.core.datavars import DataVarsCore from calculate.lib.cl_lang import setLocalTranslate setLocalTranslate('cl_core3',sys.modules[__name__]) -# clear server files after restart -def clean (SID_FILE, PID_FILE, SID_PID, SIDS_DIR, PIDS_DIR): - if os.path.exists(SID_FILE): - os.unlink(SID_FILE) - if os.path.exists(PID_FILE): - os.unlink(PID_FILE) - if os.path.exists(SID_PID): - os.unlink(SID_PID) - if os.path.isdir(SIDS_DIR): - for filename in glob.glob(os.path.join(SIDS_DIR, "*.sid")): - os.unlink (filename) - if os.path.exists(filename): - print 'Not deleted file %s!!!' %filename - if os.path.isdir(PIDS_DIR): - for filename in glob.glob(os.path.join(PIDS_DIR, "*.pid")): - os.unlink (filename) +def clean(sid_file, pid_file, sid_pid, sids_dir, pids_dir): + """ + Удалить все файлы сервера после перезапуска + """ + for fn in (sid_file, pid_file, sid_pid): + if os.path.exists(fn): + os.unlink(fn) + + for dn in (sids_dir, pids_dir): + if os.path.isdir(dn): + for filename in glob.glob(os.path.join(dn, "*.sid")): + os.unlink(filename) class CoreWsdl: # watch for process diff --git core/server/func.py core/server/func.py index 9fdee9b..c167af8 100644 --- core/server/func.py +++ core/server/func.py @@ -17,6 +17,7 @@ import pickle, random import threading import sys, os, re +from os import path import traceback from traceback import print_exc from api_types import ReturnProgress,ViewParams,Integer,ViewInfo diff --git core/server/replace_class.py core/server/replace_class.py index aa83294..6e0da47 100644 --- core/server/replace_class.py +++ core/server/replace_class.py @@ -352,7 +352,7 @@ class replaceClass(): def _printOK(self): self.terminal_print('\r') - self.terminal_print.right(self.color_print.getconsolewidth()-7) + self.terminal_print.right(self.color_print.getconsolewidth()-6) self.terminal_print.bold.foreground(TextState.Colors.BLUE)("[ ") self.terminal_print.bold.foreground(TextState.Colors.GREEN)("ok") self.terminal_print.bold.foreground(TextState.Colors.BLUE)(" ]") @@ -360,7 +360,7 @@ class replaceClass(): def _printBAD(self): self.terminal_print('\r') - self.terminal_print.right(self.color_print.getconsolewidth()-7) + self.terminal_print.right(self.color_print.getconsolewidth()-6) self.terminal_print.bold.foreground(TextState.Colors.BLUE)("[ ") self.terminal_print.bold.foreground(TextState.Colors.RED)("!!") self.terminal_print.bold.foreground(TextState.Colors.BLUE)(" ]") @@ -368,7 +368,7 @@ class replaceClass(): def _printSkip(self): self.terminal_print('\r') - self.terminal_print.right(self.color_print.getconsolewidth()-9) + self.terminal_print.right(self.color_print.getconsolewidth()-8) self.terminal_print.bold.foreground(TextState.Colors.BLUE)("[ ") self.terminal_print.bold.foreground(TextState.Colors.YELLOW)("skip") self.terminal_print.bold.foreground(TextState.Colors.BLUE)(" ]") @@ -379,13 +379,12 @@ class replaceClass(): self.spinner.stop() self.spinner = None self.setProgress(100, progress_message) - if self.progressbar and self.progressbar.finished: - self.terminal_print.up(1).clear_line("") - self.terminal_print.up(1)("") - self.progressbar = None - - # если result - сообщение if self.currentTaskMessage: + if self.progressbar and self.progressbar.finished: + self.terminal_print.up(1).clear_line("") + self.terminal_print.up(1)("") + self.progressbar = None + self.displayResult(result) self.currentTaskMessage = ""