diff --git a/.travis.yml b/.travis.yml index b74aa7b..fb725c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,26 @@ +# sudo: false +# cache: +# directories: +# - "$HOME" language: python matrix: include: - - python: 2.7.8 - dist: precise - before_install: pip install --upgrade pip setuptools + # - python: 2.7.8 + # dist: precise + # before_install: pip install --upgrade pip setuptools - python: 2.7 - python: 3.7 allow_failures: - python: 3.7 install: + # - if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then travis_retry pip install -r requirements.txt ; fi + # - if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then travis_retry pip install coveralls ; fi - travis_retry pip install coveralls -r requirements.txt script: - - flake8 . - - python setup.py test - coverage run --source=src setup.py test + - flake8 *.py + - flake8 src/wpsremote + - flake8 test after_success: coveralls notifications: email: diff --git a/requirements.txt b/requirements.txt index 630ad1d..7898310 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ asn1crypto==0.24.0 +astroid==1.4.4 autopep8==1.4.3 bcrypt==3.1.4 bleach==3.1.0 @@ -11,17 +12,20 @@ cryptography==2.3.1 docutils==0.15.2 enum34==1.1.6 flake8==3.7.8 -functools32==3.2.3.post2 idna==2.7 ipaddress==1.0.22 jsonschema==2.5.1 lazy-object-proxy==1.2.1 +mccabe<0.7.0,>=0.6.0 +pep8==1.7.1 paramiko==2.4.2 pkginfo==1.5.0.1 psutil==5.4.7 pyasn1==0.4.4 +pycodestyle<2.6.0,>=2.5.0 pycparser==2.18 pycrypto==2.6.1 +pyflakes<2.2.0,>=2.1.0 Pygments==2.4.2 pylint==1.5.4 PyNaCl==1.2.1 diff --git a/setup.py b/setup.py index 7f49260..f3c6130 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ try: readme_text = file('README.md', 'rb').read() except IOError as e: - readme_text = '' + readme_text = open('README.md', 'rb').read() setup( name="wps-remote", diff --git a/src/wpsremote/resource_monitor.py b/src/wpsremote/resource_monitor.py index cbb9e22..31f1729 100644 --- a/src/wpsremote/resource_monitor.py +++ b/src/wpsremote/resource_monitor.py @@ -4,6 +4,7 @@ # This code is licensed under the GPL 2.0 license, available at the root # application directory. +# import time import psutil import logging import threading diff --git a/src/wpsremote/xmpp_data/configs/myservice/code/test_xml.py b/src/wpsremote/xmpp_data/configs/myservice/code/test_xml.py index 11b444a..d8b72db 100644 --- a/src/wpsremote/xmpp_data/configs/myservice/code/test_xml.py +++ b/src/wpsremote/xmpp_data/configs/myservice/code/test_xml.py @@ -22,7 +22,7 @@ def run(self): ret = 0 self.logger.info("ProgressInfo:100%") - except: + except BaseException: ret = -1 self.logger.critical("Error occurred during processing.") diff --git a/src/wpsremote/xmpp_data/configs/myservice/myservice.7z b/src/wpsremote/xmpp_data/configs/myservice/myservice.7z new file mode 100644 index 0000000..ece6127 Binary files /dev/null and b/src/wpsremote/xmpp_data/configs/myservice/myservice.7z differ diff --git a/src/wpsremote/xmpp_data/configs/myservice/service.config.test_xml b/src/wpsremote/xmpp_data/configs/myservice/service.config.test_xml new file mode 100644 index 0000000..6453e47 --- /dev/null +++ b/src/wpsremote/xmpp_data/configs/myservice/service.config.test_xml @@ -0,0 +1,102 @@ +# (c) 2016 Open Source Geospatial Foundation - all rights reserved +# (c) 2014 - 2015 Centre for Maritime Research and Experimentation (CMRE) +# (c) 2013 - 2014 German Aerospace Center (DLR) +# This code is licensed under the GPL 2.0 license, available at the root +# application directory. + +# This is a INI file to be read with python ConfigParser (https://docs.python.org/2/library/configparser.html) +# Is possible to reference another variable in the ini file using the format %()s (note the 's' at the end) + +# ########################################### # +# Default Service Params # +# ########################################### # + +[DEFAULT] +service = Greetings +namespace = default +description = Greetings Remote Service +executable_path = ./xmpp_data/configs/myservice/code +executable_cmd = python %(executable_path)s/test_xml.py +output_dir = ./xmpp_data/output/ +unique_execution_id = %(unique_exe_id)s +workdir = %(output_dir)s/%(unique_execution_id)s +active = True +max_running_time_seconds = 300 + +# . This option allows you to set the CPU and Memory average load scan time. +# . It is espressed in 'minutes' and if disabled here it will be set by default +# . to 15 minutes. +load_average_scan_minutes = 1 + +# . Use this option to completely avoid using this host (and prevent starting a new +# . 'processbot') whenever one of the following process names are running. +# . In other words, if one of the following processes are currently running on this machine, +# . GeoServer won't send any WPS execute request until they are finished. +process_blacklist = [{"cwd": "/mnt/d/work/code/python/geonode/geonode-master", "name": "celery", "cmdline": "-A geonode.celery_app:app worker -Q default,geonode,cleanup,update,email -B -E -l INFO"}] + +# ########################################### # +# Inputs and Actions Declaration # +# ########################################### # + +[Input1] +class = param +name = theName +title = theName +type = string +description = theName. +min = 1 +max = 1 +default = Giovanni + +[Action1] +class = cmdline +input_ref = theName +alias = n +template = -name value + +[Const1] +class = const +name = workdir +type = string +description = Remote process sandbox working directory +value = %(workdir)s + +[Action2] +class = cmdline +input_ref = workdir +alias = w +template = -name value + +[Const2] +class = const +name = execution_id +type = string +description = Remote process unique execution id +value = %(unique_execution_id)s + +[Action2] +class = cmdline +input_ref = execution_id +alias = e +template = -name value + +# ########################################### # +# Output Parameters Declaration # +# ########################################### # + +[Output1] +name = result1 +type = text/xml;subtype=gml/3.1.1 +output_mime_type = application/xml +description = WPS Resource XML File +title = greetings.xml +filepath = D:/work/code/python/remote-wps/RemoteWPS/src/wpsremote/%(workdir)s/greetings.xml +publish_as_layer = false + +# ########################################### # +# Logging Options Declaration # +# ########################################### # + +[Logging] +stdout_parser = [.*\[DEBUG\](.*), .*\[INFO\] ProgressInfo\:([-+]?[0-9]*\.?[0-9]*)\%, .*\[(INFO)\](.*), .*\[(WARN)\](.*), .*\[(ERROR)\](.*), .*\[(CRITICAL)\](.*)] +stdout_action = [ignore, progress, log, log, abort, abort] diff --git a/test_suite.sh b/test_suite.sh index a9122a0..1125566 100644 --- a/test_suite.sh +++ b/test_suite.sh @@ -2,8 +2,8 @@ set -e echo "Running... test_computation_job_inputs" -python test/test_computation_job_inputs.py +coverage run --source=src test/test_computation_job_inputs.py echo "Running... test_process_input_parameters" -python test/test_process_input_parameters.py +coverage run --source=src test/test_process_input_parameters.py