配置
目录
配置¶
每次都将所有参数指定给 Gateway
或 GatewayCluster
构造函数可能会容易出错,特别是在与新用户共享此工作流程时。为了简化,您可以在配置文件中提供默认值,传统上位于 ~/.config/dask/gateway.yaml
或 /etc/dask/gateway.yaml
。请注意,此配置是可选的,仅在构造函数中未指定时更改默认值。您只需要设置您关心的字段,未设置的字段将回退到默认配置。
我们建议管理员创建配置文件与用户共享,指定连接到其 dask-gateway-server
所需的地址和认证信息。例如
示例
# ~/.config/dask/gateway.yaml
gateway:
# The full address to the dask-gateway server.
address: http://146.148.58.187
# The full address to the dask-gateway scheduler proxy
proxy-address: tls://35.202.68.87:8786
auth:
# Use kerberos for authentication
type: kerberos
用户现在可以创建 Gateway
或 GatewayCluster
对象,而无需指定任何额外信息。
from dask_gateway import GatewayCluster
cluster = GatewayCluster()
cluster.scale(20)
有关 Dask 配置的更多信息,请参见 Dask 配置文档。
默认配置¶
默认配置文件如下
gateway:
address: null # The full address to the dask-gateway server.
# May also be a template string, which will be formatted
# with any environment variables before usage.
public-address: null # The address to the dask-gateway server, as accessible
# from a web browser. This will be used as the root of
# all browser-facing links (e.g. the dask dashboard).
# If `None` (default), `gateway.address` will be used.
# May be a template string.
proxy-address: null # The full address or port to the dask-gateway
# scheduler proxy. If a port, the host/ip is taken from
# ``address``. If null, defaults to `address`.
# May also be a template string.
auth:
type: basic # The authentication type to use. Options are basic,
# kerberos, jupyterhub, or a full class path to a
# custom class.
kwargs: {} # Keyword arguments to use when instantiating the
# authentication class above. Values may be template
# strings.
http-client:
proxy: true # The http proxy configuration to use when contacting
# the dask-gateway server. If `true` (default), this is
# inferred from your environment (i.e. `HTTP(S)_PROXY`
# environment variables). Set to `false` to disable
# this inference. You may also specify a proxy address
# explicitly (e.g. `http://user:password@host:port`).
# May be a template string.
cluster:
options: {} # Default options to use when calling ``new_cluster`` or
# ``cluster_options``. Values may be template strings.