Configuration File

From PyWPS
Jump to: navigation, search

Setting up the configuration file

Configuration file for PyWPS can be located on several places. There are global and local PyWPS configuration files. The locals will rewrite values stored in global files.

Global configuration:

  1. File /etc/pywps.cfg (on Linux/Unix)
  2. File /usr/local/pywps-VERSION/etc/pywps.cfg, which means the file pywps.cfg in directory etc, located in PyWPS install location.

Local configuration:

In this case a configuration file is used for a particular PyWPS instance. Each particular instance uses the file stored in PYWPS_CFG environment variable. This can be set either via web server configuration or with help of any wrapper script (See: Wrapper Script )

For example a local file can be located in: /usr/local/wps/pywps.cfg

File configuration sections:

Please note that the configuration file is case-sensitive

Several sections exist in the file.

The [wps] section contains the meta-information necessary to populate the WPS response, mainly information on who provides the service, restrictions, fees and a brief description on the service.

[wps]

contains general WPS settings, which are:
encoding:
Language encoding (utf-8, iso-8859-2, windows-1250, dots)
title
Server title
version
WPS version (1.0.0)
abstract
Server abstract
fees
Possible fees
constraints
Possible constraints
serveraddress
WPS script address: http://foo/bar/wps.py
keywords
Comma-separated list of keywords
lang
Default language (eng)


The [server] section defines the setting parameters of PyWPS, mainly path locations, URL translation and service limits.

[server]

maxoperations
Maximal number of parallel running processes. If set to 0, then there is no limit.
maxinputparamlength
Maximal length of string input parameter (number of characters)
maxfilesize
Maximal input file size (raster or vector). The size can be determined as follows: 1GB, 5MB, 3kB, 1000b.
tempPath
Directory for temporary files (mostly temporary GRASS locations) (/tmp).
outputUrl
Url where the outputs are stored.
outputPath
Path. where output files are stored.
debug
true/false - makes the logs for verbose
This option has been depreciated in version 3.2. and LogLevel will be used to define log verbose
logLevel
new in version 3.2 use logLevel=DEBUG for complete debug information
logFile
(since 3.0.1) File, where all logs from PyWPS are going to. If not set, default error.log from Web Server configuration is used. Sometimes, this can cause problem for the asynchronous calls.
processesPath
path to folder containing the processes. Default is pywps/processes. NOTE:You can set also PYWPS_PROCESSES environment variable with same result.

If using GRASS/GIS is it is advisable to configure the following section (if not it can be skipped) [grass]

path
$PATH variable, e.g. /usr/lib/grass/bin
addonPath
$GRASS_ADDONS variable
version
GRASS version
gui
Should be “text”
gisbase
Path to GRASS GIS_BASE directory (/usr/lib/grass)
ldLibraryPath
Path of GRASS Libs (/usr/lib/grass/lib)
gisdbase
Full path to location directory (/home/foo/grassdata)
NOTE: You do not have to setup this variable in the configuration file globally. You can use grassLocation attribute while calling the _ _init _ _ method of Process class, during process initialization. See section GRASS for more details.

Configuration file example:

A configuration could look more or less like this:

[wps]
encoding=utf-8
title=PyWPS Server
version=1.0.0
abstract=See http://pywps.wald.intevation.org and http://www.opengeospatial.org/standards/wps
fees=None
constraints=none
serveraddress=http://localhost/cgi-bin/wps
keywords=GRASS,GIS,WPS
lang=eng

[provider]
providerName=Your Company Name
individualName=Your Name
positionName=Your Position
role=Your role
deliveryPoint=Street
city=City
postalCode=000 00
country=eu
electronicMailAddress=login@server.org
providerSite=http://foo.bar
phoneVoice=False
phoneFacsimile=False
administrativeArea=False

[server]
maxoperations=3
maxinputparamlength=1024
maxfilesize=3mb
tempPath=/tmp
processesPath=
outputUrl=http://localhost/wps/wpsoutputs
outputPath=/var/www/wps/wpsoutputs
debug=true
logFile=/var/log/pywps.log

[grass]
path=/usr/lib/grass/bin/:/usr/lib/grass/scripts/
addonPath=
version=6.2.1
gui=text
gisbase=/usr/lib/grass/
ldLibraryPath=/usr/lib/grass/lib
gisdbase=/home/foo/datagrass

FTP support

SVN rev:1271 introduced FTP support in PyWPS. Basically a user can define a FTP location where the WPS process output will store the outputs (WPS response as reference).

FTP support is automatically activated when parameter outputPath starts with string "ftp://". The configuration file requires the following variables to be set:

[server]

outputPath
FTP Path. FTP Path (host+path) where outputdata will be stored: e.g. ftp://127.0.0.1/foo/
outputUrl
URL parameter should be set to the FTP path
ftplogin
FTP user login e.g: 'user'. If string is empty , PyWPS will use anonymous login
ftppasswd
FTP password e.g '1234'
ftpport
FTP port number. Default port is 21. Non root ports are run in numbers above 1024


Pitfalls

Generic "pitfalls" in the configuration file

maxfilesize

the maxfilesize defines the maximum input size, this parameter is normally used to set buffer sizes inside pywps. While the code is being executed the python interpreter will have to temporary request a memory allocation with a size identical to maxfilesize. If the OS can't allocate the requested amount, the python interpreter will report a "MemoryError" Exception

"/usr/local/lib/python2.7/dist-packages/pywps-soap_branch-py2.7.egg/pywp
 s/Parser/Post.py", line 94, in parse
     inputXml = file.read(maxFileSize)
 MemoryError
[Fri Mar 02 16:04:38 2012] [error] [client 127.0.0.1] Premature end of
 script headers: wps
PyWPS NoApplicableCode: Locator: None; Value: No query string found.

Either the maxfilesize value has to be reduced to allow a malloc() OR the parameter can be set to zero (unlimit input size)

[server]
maxfilesize=0


--Wikiadmin 15:41, 10 January 2011 (UTC)