Configuration

Configuration

Specifying all parameters to the Gateway or GatewayCluster constructors every time may be error prone, especially when sharing this workflow with new users. To simplify things you can provide defaults in a configuration file, traditionally held in ~/.config/dask/gateway.yaml or /etc/dask/gateway.yaml. Note that this configuration is optional, and only changes the defaults when not specified in the constructors. You only need to set the fields you care about, unset fields will fall back to the default configuration.

We recommend administrators create a configuration file to share with their users, specifying the addresses and authentication necessary to connect to their dask-gateway-server. For example:

Example:

# ~/.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

Users can now create Gateway or GatewayCluster objects without specifying any additional information.

from dask_gateway import GatewayCluster

cluster = GatewayCluster()
cluster.scale(20)

For more information on Dask configuration see the Dask configuration documentation.

Default Configuration

The default configuration file is as follows

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.