Skip to content

Commit

Permalink
New feature: set HOME to pywps process tempdir (geopython#220)
Browse files Browse the repository at this point in the history
* added sethomedir flag

Conflicts:
	pywps/configuration.py

* fixed debug message
  • Loading branch information
cehbrecht authored and jachym committed Feb 18, 2017
1 parent fe5dc10 commit 2009761
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pywps/app/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ def _store_process(self, stored, wps_request, wps_response):
def _run_process(self, wps_request, wps_response):
try:
self._set_grass()
# if required set HOME to the current working directory.
if config.get_config_value('server', 'sethomedir') is True:
os.environ['HOME'] = self.workdir
LOGGER.info('Setting HOME to current working directory: %s', os.environ['HOME'])
LOGGER.debug('ProcessID=%s, HOME=%s', self.uuid, os.environ.get('HOME'))
wps_response.update_status('PyWPS Process started', 0)
wps_response = self.handler(wps_request, wps_response)

Expand Down
3 changes: 3 additions & 0 deletions pywps/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def load_configuration(cfgfiles=None):
CONFIG.set('server', 'outputpath', outputpath)
CONFIG.set('server', 'workdir', tempfile.gettempdir())
CONFIG.set('server', 'parallelprocesses', '2')
# If this flag is enabled it will set the HOME environment
# for each process to its current workdir (a temp folder).
CONFIG.set('server', 'sethomedir', 'false')

CONFIG.add_section('logging')
CONFIG.set('logging', 'file', '')
Expand Down

0 comments on commit 2009761

Please sign in to comment.