Closed sjperkins closed 2 years ago
@o-smirnov @JSKenyon @landmanbester
This PR modifies dask-ms
to use donfig for configuration options.
donfig searches for yaml configuration files in the following locations.
In particular, if we create the following yaml:
storage_options:
s3://test-bucket-ee575396:
client_kwargs:
endpoint_url: https://127.0.0.1:9000
region_name: af-south-1
verify: false
key: XXXXXX
secret: XXXXXX
then any URL prefixed with s3://test-bucket-ee575396
, for e.g. DaskMSStore("s3://test-bucket-ee575396/a/sub/directory")
will result in the DaskMSStore
being assigned those storage_options
.
@o-smirnov I know you are concerned about credentials in the clear (https://github.com/ratt-ru/dask-ms/issues/234) but note that the AWS Command Line interface interacts with credentials stored in ~/.aws/credentials
with user permissions only. See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html for example.
In fact, the test case passes if I remove key
and secret
from the above yaml and place them in ~/.aws/credentials/
.
I'm therefore less concerned about storing credentials in a yaml file. Also note it's possible to create multiple yaml files: donfig will merge them into a unified configuration. This means that we could split sensitive and non-sensitive configuration, if necessary.
donfig also supports setting configuration via environment variables. I'm trying to work out if the above approach would work with them as urls contain invalid characters from a bash variable perspective.
This looks good to me @sjperkins. Those of use who have used from_url_and_kw
will just need to switch over when this is merged.
Cool, looks nice and flexible, and easy to integrate with stimela.
I have moved QuartiCal's main branch over to this new functionality (PR pending). One thing I ran into was that the omission of the 's' in 'https' caused things to break (port-forwarding came down) - just a cautionary tale for anyone else moving over.
[x] Tests added / passed
If the pep8 tests fail, the quickest way to correct this is to run
autopep8
and thenflake8
andpycodestyle
to fix the remaining issues.[x] Fully documented, including
HISTORY.rst
for all changes and one of thedocs/*-api.rst
files for new APITo build the docs locally: