File: configuration.rst

package info (click to toggle)
pywps 4.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,016 kB
  • sloc: python: 8,846; xml: 723; makefile: 106
file content (299 lines) | stat: -rw-r--r-- 9,936 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
.. _configuration:

Configuration
=============

PyWPS is configured using a configuration file. The file uses the
`ConfigParser <https://wiki.python.org/moin/ConfigParserExamples>`_ format, with
interpolation initialised using `os.environ`.

.. versionadded:: 4.0.0
.. warning:: Compatibility with PyWPS 3.x: major changes have been made
  to the config file in order to allow for shared configurations with `PyCSW
  <https://pycsw.org/>`_ and other projects.

The configuration file has several sections:

    * `metadata:main` for the server metadata inputs
    * `server` for server configuration
    * `processing` for processing backend configuration
    * `logging` for logging configuration
    * `grass` for *optional* configuration to support `GRASS GIS
      <https://grass.osgeo.org>`_
    * `s3` for *optional* configuration to support AWS S3 storage

PyWPS ships with a sample configuration file (``default-sample.cfg``).
A similar file is also available in the `flask` service as
described in :ref:`flask` section.

Copy the file to ``default.cfg`` and edit the following:

[metadata:main]
---------------

The `[metadata:main]` section was designed according to the `PyCSW project
configuration file <https://docs.pycsw.org/en/latest/configuration.html>`_.

:identification_title:
    the title of the service
:identification_abstract:
    some descriptive text about the service
:identification_keywords:
    comma delimited list of keywords about the service
:identification_keywords_type:
    keyword type as per the `ISO 19115 MD_KeywordTypeCode codelist
    <http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode>`_).
    Accepted values are ``discipline``, ``temporal``, ``place``, ``theme``,
    ``stratum``
:identification_fees:
    fees associated with the service
:identification_accessconstraints:
    access constraints associated with the service
:provider_name:
    the name of the service provider
:provider_url:
    the URL of the service provider
:contact_name:
    the name of the provider contact
:contact_position:
    the position title of the provider contact
:contact_address:
    the address of the provider contact
:contact_city:
    the city of the provider contact
:contact_stateorprovince:
    the province or territory of the provider contact
:contact_postalcode:
    the postal code of the provider contact
:contact_country:
    the country of the provider contact
:contact_phone:
    the phone number of the provider contact
:contact_fax:
    the facsimile number of the provider contact
:contact_email:
    the email address of the provider contact
:contact_url:
    the URL to more information about the provider contact
:contact_hours:
    the hours of service to contact the provider
:contact_instructions:
    the how to contact the provider contact
:contact_role:
    the role of the provider contact as per the `ISO 19115 CI_RoleCode codelist
    <http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode>`_).
    Accepted values are ``author``, ``processor``, ``publisher``, ``custodian``,
    ``pointOfContact``, ``distributor``, ``user``, ``resourceProvider``,
    ``originator``, ``owner``, ``principalInvestigator``

.. _server-configuration:

[server]
--------

:url:
    the URL of the WPS service endpoint

:language:
    a comma-separated list of ISO 639-1 language and ISO 3166-1 alpha2 country
    code of the service
    (e.g. ``en-CA``, ``fr-CA``, ``en-US``)

:encoding:
    the content type encoding (e.g. ``ISO-8859-1``, see
    https://docs.python.org/2/library/codecs.html#standard-encodings).  Default
    value is 'UTF-8'

:parallelprocesses:
    maximum number of parallel running processes - set this number carefully.
    The effective number of parallel running processes is limited by the number
    of cores  in the processor of the hosting machine. As well, speed and
    response time of hard drives impact ultimate processing performance. A
    reasonable number of parallel running processes is not higher than the
    number of processor cores. -1 for no limit.

:maxrequestsize:
    maximal request size. 0 for no limit.

:maxsingleinputsize:
    maximal request size for a single input. 0 for no limit.

:maxprocesses:
    maximal number of requests being stored in queue, waiting till they can be
    processed (see ``parallelprocesses`` configuration option). -1 for no limit.

:workdir:
    a directory to store all temporary files (which should be always deleted,
    once the process is finished).

:outputpath:
    server path where to store output files.

:outputurl:
    corresponding URL

:allowedinputpaths:
     server paths which are allowed to be used by file URLs. A list of paths
     must be seperated by `:`.

     Example: `/var/lib/pywps/downloads:/var/lib/pywps/public`

     By default no input paths are allowed.

:cleantempdir:
    flag to enable removal of process temporary workdir after process has finished.

    Default = `true`.

.. note:: `outputpath` and `outputurl` must correspond. `outputpath` is the name
        of the resulting target directory, where all output data files are
        stored (with unique names). `outputurl` is the corresponding full URL,
        which is targeting to `outputpath` directory.

        Example: `outputpath=/var/www/wps/outputs` shall correspond with
        `outputurl=http://foo.bar/wps/outputs`

:storagetype:
    The type of storage to use when storing status and results. Possible values are: ``file``, ``s3``. Defaults to ``file``.

:storage_copy_function:
    When using file storage you can choose the copy function. Possible values are:

    * ``copy``: using ``shutil.copy2``,
    * ``move``: using ``shutil.move``,
    * ``link``: using ``os.link`` (hardlink).

    Default: ``copy``.

[processing]
------------

:mode:
    the mode/backend used for processing. Possible values are:
    `default`, `multiprocessing` and `scheduler`. `default` is the same as
    `multiprocessing` and is the default value ... all processes are executed
    using the Python multiprocessing module on the same machine as the PyWPS
    service. `scheduler` is used to enable the job scheduler extension and
    process execution is delegated to a configured scheduler system like Slurm
    and Grid Engine.

:path:
    path to the PyWPS `joblauncher` executable. This option is only used for
    the `scheduler` backend and is by default set automatically:
    `os.path.dirname(os.path.realpath(sys.argv[0]))`

:drmaa_native_specification:
    option to set the DRMAA native specification, for example to limit number of
    CPUs and memory usage. Example: `--cpus-per-task=1 --mem=1024`.
    See DRMAA docs for details: https://github.com/natefoo/slurm-drmaa

[logging]
---------

:level:
    the logging level (see
    https://docs.python.org/3/library/logging.html#logging-levels)

:format:
    the format string used by the logging `:Formatter:` (see
    https://docs.python.org/3/library/logging.html#logging.Formatter).
    For example: ``%(asctime)s] [%(levelname)s] %(message)s``.

:file:
    the full file path to the log file for being able to see possible error
    messages.

:database:
    Connection string to database where the login about requests/responses is to be stored. We are using `SQLAlchemy <https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls>`_
    please use the configuration string. The default is SQLite3 `:memory:` object, however this has `known issues <https://github.com/geopython/pywps/issues?utf8=%E2%9C%93&q=is%3Aissue+async+sqlite>`_ with async processing and should be avoided.


[grass]
-------

:gisbase:
  directory of the GRASS GIS instalation, refered as `GISBASE
  <https://grass.osgeo.org/grass73/manuals/variables.html>`_


[s3]
----

:bucket:
  Name of the bucket to store files in. e.g. ``my-wps-results``

:region:
  Region in which the bucket refered to above exists. e.g. ``us-east-1``

:public:
  Set this to ``true`` if public access to status and result files is desired. Defaults to ``false``.

:prefix:
  Prefix to prepend to all file paths written to the S3 bucket by PyWPS. e.g. ``wps/results``

:encrypt:
  Set this to ``true`` if encryption at rest is desired. Defaults to ``false``

-----------
Sample file
-----------
::

  [server]
  encoding=utf-8
  language=en-US
  url=http://localhost/wps
  maxoperations=30
  maxinputparamlength=1024
  maxsingleinputsize=
  maxrequestsize=3mb
  temp_path=/tmp/pywps/
  processes_path=
  outputurl=/data/
  outputpath=/tmp/outputs/
  workdir=
  allowedinputpaths=/tmp
  storagetype=file

  [metadata:main]
  identification_title=PyWPS Processing Service
  identification_abstract=PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
  identification_keywords=PyWPS,WPS,OGC,processing
  identification_keywords_type=theme
  identification_fees=NONE
  identification_accessconstraints=NONE
  provider_name=Organization Name
  provider_url=https://pywps.org/
  contact_name=Lastname, Firstname
  contact_position=Position Title
  contact_address=Mailing Address
  contact_city=City
  contact_stateorprovince=Administrative Area
  contact_postalcode=Zip or Postal Code
  contact_country=Country
  contact_phone=+xx-xxx-xxx-xxxx
  contact_fax=+xx-xxx-xxx-xxxx
  contact_email=Email Address
  contact_url=Contact URL
  contact_hours=Hours of Service
  contact_instructions=During hours of service.  Off on weekends.
  contact_role=pointOfContact

  [processing]
  mode=default

  [logging]
  level=INFO
  file=logs/pywps.log
  database=sqlite:///logs/pywps-logs.sqlite3
  format=%(asctime)s] [%(levelname)s] file=%(pathname)s line=%(lineno)s module=%(module)s function=%(funcName)s %(message)s

  [grass]
  gisbase=/usr/local/grass-7.3.svn/

  [s3]
  bucket=my-org-wps
  region=us-east-1
  prefix=appname/coolapp/
  public=true
  encrypt=false