File tree Expand file tree Collapse file tree 4 files changed +44
-2
lines changed
cumulus_lambda_functions/stage_in_out
docker/stage-in-stage-out Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
+ ## [ 3.3.0] - 2023-01-23
9
+ ### Added
10
+ - [ #134 ] ( https://github.com/unity-sds/unity-data-services/pull/134 ) feat: add option to parse downloading stac from file
11
+
8
12
## [ 3.2.0] - 2023-01-23
9
13
### Added
10
14
- [ #131 ] ( https://github.com/unity-sds/unity-data-services/pull/131 ) granules query pagination
Original file line number Diff line number Diff line change @@ -19,11 +19,25 @@ def __init__(self) -> None:
19
19
self .__s3 = AwsS3 ()
20
20
self .__granules_json = []
21
21
22
+ def __retrieve_stac_json (self ):
23
+ raw_stac_json = os .environ .get (self .STAC_JSON )
24
+ try :
25
+ self .__granules_json = json .loads (raw_stac_json )
26
+ return self
27
+ except :
28
+ LOGGER .debug (f'raw_stac_json is not STAC_JSON: { raw_stac_json } . trying to see if file exists' )
29
+ if not FileUtils .file_exist (raw_stac_json ):
30
+ raise ValueError (f'missing file or not JSON: { raw_stac_json } ' )
31
+ self .__granules_json = FileUtils .read_json (raw_stac_json )
32
+ if self .__granules_json is None :
33
+ raise ValueError (f'{ raw_stac_json } is not JSON' )
34
+ return self
35
+
22
36
def __set_props_from_env (self ):
23
37
missing_keys = [k for k in [self .STAC_JSON , self .DOWNLOAD_DIR_KEY ] if k not in os .environ ]
24
38
if len (missing_keys ) > 0 :
25
39
raise ValueError (f'missing environment keys: { missing_keys } ' )
26
- self .__granules_json = json . loads ( os . environ . get ( self . STAC_JSON ) )
40
+ self .__retrieve_stac_json ( )
27
41
self .__download_dir = os .environ .get (self .DOWNLOAD_DIR_KEY )
28
42
self .__download_dir = self .__download_dir [:- 1 ] if self .__download_dir .endswith ('/' ) else self .__download_dir
29
43
return self
You can’t perform that action at this time.
0 commit comments