配置¶
pywps是使用配置文件配置的。文件使用 ConfigParser 格式,插值初始化使用 os.environ .
4.0.0 新版功能.
警告
与PYWPS 3.x的兼容性:为了允许与 PyCSW 以及其他项目。
配置文件有几个部分:
metadata:main 对于服务器元数据输入
server 用于服务器配置
jobqueue 用于作业队列配置
processing 用于处理后端配置
logging 用于日志记录配置
grass for optional configuration to support GRASS GIS
s3 对于 可选择的 支持AWS S3存储的配置
pywps附带了一个示例配置文件 (default-sample.cfg
)类似的文件也可以在 flask 中描述的服务 Flask 服务及其处理示例 部分。
将文件复制到 default.cfg
并编辑以下内容:
[元数据:main]¶
这个 [metadata:main] section was designed according to the PyCSW project configuration file .
- identification_title
服务的名称
- identification_abstract
关于服务的一些描述性文本
- identification_keywords
以逗号分隔的有关服务的关键字列表
- identification_keywords_type
关键字类型根据 ISO 19115 MD_KeywordTypeCode codelist )可接受的值是
discipline
,temporal
,place
,theme
,stratum
- identification_fees
服务相关费用
- identification_accessconstraints
与服务关联的访问约束
- provider_name
服务提供商的名称
- provider_url
服务提供者的url
- contact_name
提供程序联系人的名称
- contact_position
提供者联系人的职位名称
- contact_address
提供程序联系人的地址
- contact_city
供应商联系人所在城市
- contact_stateorprovince
提供方联系人所在的省或地区
- contact_postalcode
提供商联系人的邮政编码
- contact_country
提供方联系人的国家
- contact_phone
提供商联系人的电话号码
- contact_fax
提供方联系人的传真号码
- contact_email
提供程序联系人的电子邮件地址
- contact_url
提供程序联系人的详细信息的url
- contact_hours
联系提供商的服务时间
- contact_instructions
如何联系提供者联系人
- contact_role
根据 ISO 19115 CI_RoleCode codelist )可接受的值是
author
,processor
,publisher
,custodian
,pointOfContact
,distributor
,user
,resourceProvider
,originator
,owner
,principalInvestigator
[服务器]¶
- 网址
wps服务端点的url
- 语言
服务的ISO 639-1语言和ISO 3166-1字母2国家代码的逗号分隔列表(例如。
en-CA
,fr-CA
,en-US
)- 编码
内容类型编码(例如
ISO-8859-1
,请参见https://docs.python.org/2/library/codecs.html标准编码)。默认值为“utf-8”- 过程
用于配置进程列表的可选参数。看到了吗 使用Werkzeug启动PyWPS . 它使用的是Python表达式,它将使用
importlib
. 例如使用 myapp.processes.processes 它指向应用程序中进程的Python列表:processes = [Sleep(), SayHello()]
.- 并行进程
并行运行进程的最大数目-请仔细设置此数目。并行运行进程的有效数量受宿主计算机的处理器中的内核数量的限制。此外,硬盘的速度和响应时间也会影响最终的处理性能。合理的并行运行进程数不高于处理器核心数。
- 最大请求大小
最大请求大小。0表示无限制
- 最大进程
存储在队列中等待处理的最大请求数(请参阅
parallelprocesses
配置选项)。- 工作迪尔
存储所有临时文件的目录(在处理完成后,应始终将其删除)。
- 输出路径
存储输出文件的服务器路径。
- 输出URL
对应的URL
- 允许的输入路径
允许文件URL使用的服务器路径。路径列表必须由 : .
例子: /var/lib/pywps/downloads:/var/lib/pywps/public
默认情况下不允许输入路径。
- 克兰坦普迪尔
用于在进程完成后移除进程临时工作区的标志。
默认值= true .
备注
outputpath 和 outputurl 必须对应。 outputpath 是生成的目标目录的名称,其中存储了所有输出数据文件(具有唯一的名称)。 outputurl 是对应的完整url,其目标是 outputpath 目录。
例子: outputpath=/var/www/wps/outputs 应符合 outputurl=http://foo.bar/wps/outputs
- 存储类型
存储状态和结果时要使用的存储类型。可能的值包括:
file
,s3
.默认为file
.
[处理]¶
- 模式
用于处理的模式/后端。可能值为: default , multiprocessing 和 scheduler . default 是一样的 multiprocessing 是默认值…所有进程都使用python多处理模块在与pywps服务相同的机器上执行。 scheduler 用于启用作业计划程序扩展,并将进程执行委派给已配置的计划程序系统,如slurm和网格引擎。
- 路径
pywps的路径 joblauncher 可执行的。此选项仅用于 scheduler 后端,默认情况下自动设置: os.path.dirname(os.path.realpath(sys.argv[0]))
[登录中]¶
- 水平
日志级别(请参阅https://docs.python.org/3/library/logging.html日志级别)
- 格式
日志记录使用的格式字符串 :Formatter: (见https://docs.python.org/3/library/logging.html 35; logging.formatter)。例如:
%(asctime)s] [%(levelname)s] %(message)s
.- 文件
日志文件的完整文件路径,用于查看可能的错误消息。
- 数据库
数据库的连接字符串,其中存储有关请求/响应的登录信息。我们正在使用 SQLAlchemy 请使用配置字符串。默认值是sqlite3 :memory: object, however this has known issues 与异步处理和应避免。
- db_echo
启用数据库日志记录的标志。
默认值= false .
[grass]¶
- gisbase
GRASS GIS 安装目录,简称 GISBASE
[工作队列]¶
- 暂停
在定期检查新存储的请求之间暂停(以秒为单位)
[s3]¶
- 水桶
要在其中存储文件的存储桶的名称。例如
my-wps-results
- 区域
上面提到的bucket所在的区域。例如
us-east-1
- 公众的
设置为
true
如果需要对状态和结果文件进行公共访问。默认为false
.- 前缀
为PyWPS写入S3 bucket的所有文件路径添加前缀。例如
wps/results
- 加密
设置为
true
如果需要静态加密。默认为false
样本文件¶
[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/
[jobqueue]
pause=30
[s3]
bucket=my-org-wps
region=us-east-1
prefix=appname/coolapp/
public=true
encrypt=false