Skip to content

Commit

Permalink
Merge pull request #136 from ldesousa/master
Browse files Browse the repository at this point in the history
Closes #135.
  • Loading branch information
ldesousa authored Jun 23, 2016
2 parents 4e6ff4b + ad4601d commit d571361
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pywps/app/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from pywps.app.WPSRequest import WPSRequest
import pywps.configuration as config
from pywps.exceptions import StorageNotSupported, OperationNotSupported, \
ServerBusy
ServerBusy, NoApplicableCode


LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -224,7 +224,7 @@ def _store_process(self, stored, wps_request, wps_response):
if stored < maxprocesses:
dblog.store_process(self.uuid, wps_request)
else:
raise ServerBusy('Maximum number of paralel running processes reached. Please try later.')
raise ServerBusy('Maximum number of parallel running processes reached. Please try later.')

return wps_response

Expand All @@ -233,7 +233,7 @@ def _run_process(self, wps_request, wps_response):
wps_response = self.handler(wps_request, wps_response)

# if status not yet set to 100% then do it after execution was successful
if wps_response.status_percentage != 100:
if (not wps_response.status_percentage) or (wps_response.status_percentage != 100):
LOGGER.debug('Updating process status to 100% if everything went correctly')
wps_response.update_status('PyWPS Process finished', 100)
except Exception as e:
Expand All @@ -259,7 +259,11 @@ def _run_process(self, wps_request, wps_response):
# update the process status to display process failed
msg = 'Process error: %s.%s Line %i %s' % (fname, method_name, exc_tb.tb_lineno, e)
LOGGER.error(msg)
wps_response.update_status(msg, -1)

if not wps_response:
raise NoApplicableCode('Response is empty. Make sure the _handler method is returning a valid object.')
else:
wps_response.update_status(msg, -1)

# tr
stored_requests = dblog.get_first_stored()
Expand Down

0 comments on commit d571361

Please sign in to comment.