-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Create cartiflette's catalog | ||
""" | ||
|
||
import json | ||
import logging | ||
|
||
from s3fs import S3FileSystem | ||
|
||
from cartiflette.config import ( | ||
BUCKET, | ||
PATH_WITHIN_BUCKET, | ||
FS, | ||
) | ||
from cartiflette.s3 import make_s3_inventory | ||
|
||
logger = logging.getLogger(__name__) | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
logger.info("=" * 50) | ||
logger.info("\n%s", __doc__) | ||
logger.info("=" * 50) | ||
|
||
# Nota : no parsed needed for this command | ||
|
||
|
||
def main( | ||
bucket: str = BUCKET, | ||
path_within_bucket: str = PATH_WITHIN_BUCKET, | ||
fs: S3FileSystem = FS, | ||
): | ||
|
||
success = True | ||
try: | ||
make_s3_inventory( | ||
fs=fs, bucket=bucket, path_within_bucket=path_within_bucket | ||
) | ||
except Exception: | ||
success = False | ||
|
||
out_path = "catalog/result.json" | ||
with open(out_path, "w", encoding="utf8") as out: | ||
json.dump(success, out) | ||
|
||
logger.info("Success!") | ||
|
||
|
||
if __name__ == "__main__": | ||
main( | ||
bucket=BUCKET, | ||
path_within_bucket=PATH_WITHIN_BUCKET, | ||
fs=FS, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from .download_vectorfile import download_vectorfile_url_all | ||
from .geodataset import S3GeoDataset, concat_s3geodataset | ||
from .dataset import S3Dataset | ||
from .inventory import make_s3_inventory | ||
|
||
__all__ = [ | ||
"download_vectorfile_url_all", | ||
"S3GeoDataset", | ||
"S3Dataset", | ||
"concat_s3geodataset", | ||
"make_s3_inventory", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters