Fix for s3 region name in data locator (#1316)

There is a small chicken and egg problem.
The config file could be in s3, therefore when using the DataLocator to
download the config file, we don't yet have an app_config object.
Adding a check to handle this case.
This commit is contained in:
bmccandless
2020-03-29 09:20:34 -07:00
committed by GitHub
parent c8f98917c5
commit 03d7a107bf

View File

@@ -39,7 +39,7 @@ class DataLocator:
self.cname = self.path if self.protocol == "file" else self.uri_or_path
# fsspec.filesystem will throw RuntimeError if the protocol is unsupported
if self.protocol == "s3" and app_config.data_locator__s3__region_name:
if self.protocol == "s3" and app_config and app_config.data_locator__s3__region_name:
self.fs = fsspec.filesystem(
self.protocol, config_kwargs={"region_name": app_config.data_locator__s3__region_name}
)