diff --git a/.gitignore b/.gitignore index 9362e51..477070f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,108 @@ -.project -.pydevproject -build/ -*.pyc +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions *.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ *.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site # eclipse .project .pydevproject +.svn/ +*.png +*.pyc +schainpy/scripts -# vscode -.vscode \ No newline at end of file +schaingui/node_modules \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..e976b89 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,69 @@ +{ + "configurations": [ + { + "name": "Mac", + "includePath": [ + "/usr/include", + "/usr/local/include", + "${workspaceRoot}" + ], + "defines": [], + "intelliSenseMode": "clang-x64", + "browse": { + "path": [ + "/usr/include", + "/usr/local/include", + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + }, + { + "name": "Linux", + "includePath": [ + "/usr/include/c++/4.8.4", + "/usr/include/x86_64-linux-gnu/c++/4.8", + "/usr/local/include", + "/usr/include", + "/usr/include/x86_64-linux-gnu", + "${workspaceRoot}" + ], + "defines": [], + "intelliSenseMode": "clang-x64", + "browse": { + "path": [ + "/usr/include/c++/4.8.4", + "/usr/include/x86_64-linux-gnu/c++/4.8", + "/usr/local/include", + "/usr/include", + "/usr/include/x86_64-linux-gnu", + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + }, + { + "name": "Win32", + "includePath": [ + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", + "${workspaceRoot}" + ], + "defines": [ + "_DEBUG", + "UNICODE" + ], + "intelliSenseMode": "msvc-x64", + "browse": { + "path": [ + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*", + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + } + ], + "version": 2 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7d5f7a9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.associations": { + "arrayobject.h": "c", + "ndarrayobject.h": "c", + "complex": "c" + } +} \ No newline at end of file diff --git a/schainpy/controller.py b/schainpy/controller.py index 41f99b2..e400096 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -276,8 +276,8 @@ class OperationConf(): parameterObj = self.getParameterObj(parameterName) -# if not parameterObj: -# return None + # if not parameterObj: + # return None value = parameterObj.getValue() @@ -578,10 +578,10 @@ class ProcUnitConf(): def printattr(self): print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, - self.id, - self.name, - self.datatype, - self.inputId) + self.id, + self.name, + self.datatype, + self.inputId) for opConfObj in self.opConfObjList: opConfObj.printattr() @@ -624,13 +624,13 @@ class ProcUnitConf(): sts = self.procUnitObj.call(opType = opConfObj.type, opName = opConfObj.name, opId = opConfObj.id, - **kwargs) - -# total_time = time.time() - ini -# -# if total_time > 0.002: -# print "%s::%s took %f seconds" %(self.name, opConfObj.name, total_time) + **kwargs) + # total_time = time.time() - ini + # + # if total_time > 0.002: + # print "%s::%s took %f seconds" %(self.name, opConfObj.name, total_time) + is_ok = is_ok or sts return is_ok @@ -647,7 +647,7 @@ class ProcUnitConf(): self.procUnitObj.close() return - + class ReadUnitConf(ProcUnitConf): path = None @@ -772,16 +772,16 @@ class ReadUnitConf(ProcUnitConf): return opObj -# def makeXml(self, projectElement): -# -# procUnitElement = SubElement(projectElement, self.ELEMENTNAME) -# procUnitElement.set('id', str(self.id)) -# procUnitElement.set('name', self.name) -# procUnitElement.set('datatype', self.datatype) -# procUnitElement.set('inputId', str(self.inputId)) -# -# for opConfObj in self.opConfObjList: -# opConfObj.makeXml(procUnitElement) + # def makeXml(self, projectElement): + # + # procUnitElement = SubElement(projectElement, self.ELEMENTNAME) + # procUnitElement.set('id', str(self.id)) + # procUnitElement.set('name', self.name) + # procUnitElement.set('datatype', self.datatype) + # procUnitElement.set('inputId', str(self.inputId)) + # + # for opConfObj in self.opConfObjList: + # opConfObj.makeXml(procUnitElement) def readXml(self, upElement): @@ -1024,7 +1024,7 @@ class Project(): self.id = self.projectElement.get('id') self.name = self.projectElement.get('name') - self.description = self.projectElement.get('description') + self.description = self.projectElement.get('description') readUnitElementList = self.projectElement.iter(ReadUnitConf().getElementName()) @@ -1055,8 +1055,8 @@ class Project(): def printattr(self): print "Project[%s]: name = %s, description = %s" %(self.id, - self.name, - self.description) + self.name, + self.description) for procUnitConfObj in self.procUnitConfObjDict.values(): procUnitConfObj.printattr() @@ -1093,8 +1093,8 @@ class Project(): import socket err = traceback.format_exception(sys.exc_info()[0], - sys.exc_info()[1], - sys.exc_info()[2]) + sys.exc_info()[1], + sys.exc_info()[2]) print "***** Error occurred in %s *****" %(procUnitConfObj.name) print "***** %s" %err[-1] @@ -1126,9 +1126,9 @@ class Project(): adminObj = schainpy.admin.SchainNotify() adminObj.sendAlert(message=message, - subject=subject, - subtitle=subtitle, - filename=self.filename) + subject=subject, + subtitle=subtitle, + filename=self.filename) def isPaused(self): return 0 diff --git a/schainpy/controller_api.py b/schainpy/controller_api.py index 2c9efd1..6df488f 100644 --- a/schainpy/controller_api.py +++ b/schainpy/controller_api.py @@ -14,7 +14,7 @@ class ControllerThread(threading.Thread, Project): self.setDaemon(True) self.lock = threading.Lock() - self.control = {'stop':False, 'pause':False} + self.control = { 'stop':False, 'pause':False } def __del__(self): @@ -90,7 +90,7 @@ class ControllerThread(threading.Thread, Project): continue if thisOpObj.name in plotterList: - thisOpObj.type = "plotter" + thisOpObj.type = "other" def setPlotterQueue(self, plotter_queue): diff --git a/schainpy/model/utils/jroutils_ftp.py b/schainpy/model/utils/jroutils_ftp.py index 97ce802..3e7e2aa 100644 --- a/schainpy/model/utils/jroutils_ftp.py +++ b/schainpy/model/utils/jroutils_ftp.py @@ -583,6 +583,8 @@ class SendToServer(ProcessingUnit): self.isConfig = False self.clientObj = None + + def setup(self, server, username, password, remotefolder, localfolder, ext='.png', period=60, protocol='ftp', **kwargs): @@ -638,18 +640,20 @@ class SendToServer(ProcessingUnit): return fullfilenameList def run(self, **kwargs): - if not self.isConfig: self.init = time.time() self.setup(**kwargs) self.isConfig = True + if not self.clientObj.is_alive(): + print "[Remote Server]: Restarting connection " + self.setup(**kwargs) + if time.time() - self.init >= self.period: fullfilenameList = self.findFiles() if self.clientObj.updateFileList(fullfilenameList): print "[Remote Server]: Sending the next files ", str(fullfilenameList) - self.init = time.time() def close(self):