Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b0801de
feat: add AUDIT log level for upload
wphyojpl Oct 14, 2024
00d6bde
chore: update outdated tests
wphyojpl Oct 14, 2024
327ef8d
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Oct 21, 2024
6fd6910
chore: merge from develop
wphyojpl Oct 21, 2024
f77e47e
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Oct 21, 2024
a51314b
fix: allow empty str as RESULT_PATH_PREFIX & replace w/ default val
wphyojpl Oct 21, 2024
2d72378
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Oct 28, 2024
0c31b5f
Merge branch 'develop' of github.community-sds/mdps-ds-lib into develop
wphyojpl Oct 28, 2024
5701e60
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Nov 7, 2024
b429a12
erge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Nov 7, 2024
87e82ae
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Nov 26, 2024
b730339
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Nov 26, 2024
a6d89f6
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Dec 4, 2024
87a2858
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Dec 9, 2024
efb0d8c
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Dec 9, 2024
b908552
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Dec 16, 2024
b66e867
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Dec 16, 2024
51c9a9e
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Dec 16, 2024
1ca94c8
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Jan 8, 2025
9b6dc8d
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Jan 9, 2025
919b679
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Feb 10, 2025
6d95543
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Feb 12, 2025
44697a5
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Mar 18, 2025
75a0436
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Mar 24, 2025
9e35099
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Mar 24, 2025
494505d
fix: allowing optional original stac item
wphyojpl Apr 7, 2025
d8a0ff4
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Apr 7, 2025
65be24b
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Apr 7, 2025
8610202
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Apr 22, 2025
a314344
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Apr 29, 2025
9588b56
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl May 19, 2025
3f80164
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Jun 2, 2025
592967a
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Aug 21, 2025
7d0097e
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Sep 9, 2025
37e46cc
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Sep 24, 2025
eaa596d
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Oct 30, 2025
efffcbe
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Nov 24, 2025
8e1699f
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Nov 24, 2025
7fbc1e0
Merge branch 'develop' of github.com:unity-sds/mdps-ds-lib into develop
wphyojpl Jan 6, 2026
9166ffb
feat: get_instance_from_dict method
wphyojpl Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mdps_ds_lib/ds_client/auth_token/token_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class TokenFactory(FactoryAbstract):
DUMMY = 'DUMMY'
COGNITO = 'COGNITO'

def get_instance_from_dict(self, env_dict: dict, **kwargs):
raise NotImplementedError('not a need yet')

def get_instance_from_env(self, **kwargs):
raise NotImplementedError('not yet')

Expand Down
3 changes: 3 additions & 0 deletions mdps_ds_lib/lib/aws/es_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class ESFactory(FactoryAbstract):
AWS = 'AWS'
AWS_ES = 'AWS_ES'

def get_instance_from_dict(self, env_dict: dict, **kwargs):
raise NotImplementedError('not a need yet')

def get_instance_from_env(self, **kwargs):
raise NotImplementedError(f'not yet')

Expand Down
3 changes: 3 additions & 0 deletions mdps_ds_lib/lib/aws/no_sql_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class NoSqlFactory(FactoryAbstract):
AWS = 'AWS_DDB'
MONGO = 'MONGO_DB'

def get_instance_from_dict(self, env_dict: dict, **kwargs):
raise NotImplementedError('not a need yet')

def get_instance_from_env(self, **kwargs):
raise NotImplementedError('Not Yet')

Expand Down
7 changes: 7 additions & 0 deletions mdps_ds_lib/lib/processing_jobs/job_manager_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
class JobManagerFactory(FactoryAbstract):
MEMORY = 'MEMORY'
LOCAL = 'LOCAL'

def get_instance_from_dict(self, env_dict: dict, **kwargs):
raise NotImplementedError('not a need yet')

def get_instance_from_env(self, **kwargs):
raise NotImplementedError('not a need yet')

def get_instance(self, class_type, **kwargs):
props = JobManagerProps().load_from_json(kwargs)
fr = class_type.upper()
Expand Down
4 changes: 4 additions & 0 deletions mdps_ds_lib/lib/utils/factory_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class FactoryAbstract(ABC):
def get_instance(self, class_type, **kwargs):
return

@abstractmethod
def get_instance_from_dict(self, env_dict: dict, **kwargs):
return

@abstractmethod
def get_instance_from_env(self, **kwargs):
return
13 changes: 8 additions & 5 deletions mdps_ds_lib/stac_fast_api_client/sfa_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class SFAClientFactory(FactoryAbstract):
COOKIE_AUTH = 'COOKIE_AUTH'
BEARER_AUTH = 'BEARER_AUTH'

def get_instance_from_env(self, **kwargs) -> SFAClientBase:
if 'DS_URL' not in os.environ:
def get_instance_from_dict(self, env_dict: dict, **kwargs):
if 'DS_URL' not in env_dict:
raise RuntimeError(f'missing mandatory env: DS_URL')
class_env = {'ds_url': os.getenv('DS_URL'),
'ds_stage': '' if 'ds_stage'.upper() not in os.environ else os.getenv('ds_stage'.upper())}
class_env = {'ds_url': env_dict['DS_URL'],
'ds_stage': '' if 'ds_stage'.upper() not in env_dict else env_dict['ds_stage'.upper()]}

class_type_env_map = {
SFAClientFactory.BASIC_AUTH: {
Expand All @@ -32,7 +32,7 @@ def get_instance_from_env(self, **kwargs) -> SFAClientBase:
}
chosen_class = None
for k, v in class_type_env_map.items():
if all([k1 in os.environ for k1 in list(v.keys())]):
if all([k1 in env_dict for k1 in list(v.keys())]):
for k1, v1 in v.items():
class_env[v1] = os.getenv(k1)
chosen_class = k
Expand All @@ -41,6 +41,9 @@ def get_instance_from_env(self, **kwargs) -> SFAClientBase:
raise NotImplementedError(f'unknown class type: missing ENVs. require one of {class_type_env_map}')
return self.get_instance(chosen_class, **class_env)

def get_instance_from_env(self, **kwargs) -> SFAClientBase:
return self.get_instance_from_dict(dict(os.environ))

def get_instance(self, class_type, **kwargs) -> SFAClientBase:
if class_type == self.NO_AUTH:
from mdps_ds_lib.stac_fast_api_client.sfa_client_no_auth import SFAClientNoAuth
Expand Down
3 changes: 3 additions & 0 deletions mdps_ds_lib/stage_in_out/catalog_granules_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class CatalogGranulesFactory(FactoryAbstract):
UNITY = 'UNITY'
STAC_FAST_API = 'STAC_FAST_API'

def get_instance_from_dict(self, env_dict: dict, **kwargs):
raise NotImplementedError('not a need yet')

def get_instance_from_env(self, **kwargs):
raise NotImplementedError('not a need yet')

Expand Down
27 changes: 17 additions & 10 deletions tests/mdps_ds_lib/ds_client/test_ds_client_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,13 @@ def test_query_collections(self):
os.environ['TRUST_ENV'] = 'TRUE'
os.environ['TOKEN_FACTORY'] = 'COGNITO'
token_retriever: TokenAbstract = TokenFactory().get_instance(os.getenv('TOKEN_FACTORY'))
client = DsClientUser(token_retriever, 'https://d3vc8w9zcq658.cloudfront.net', 'am-uds-dapa')
client = DsClientUser(token_retriever, 'https://d2zjsabg0fonik.cloudfront.net', 'am-uds-dapa')
client.urn = 'URN'
client.org = 'NASA'
client.project = 'UNITY'
client.tenant = 'unity'
client.tenant_venue = 'ops'

print(client.query_collections(10))
print(client.query_collections_next())
return
Expand Down Expand Up @@ -270,16 +276,16 @@ def test_query_granules(self):
# client.collection = 'DDD-01'
# client.collection_venue = '001'
client = DsClientUser(token_retriever, 'https://d2zjsabg0fonik.cloudfront.net', 'am-uds-dapa')
client = DsClientUser(token_retriever, 'https://api.mdps.mcp.nasa.gov', 'am-uds-dapa')
# client = DsClientUser(token_retriever, 'https://api.mdps.mcp.nasa.gov', 'am-uds-dapa')
# URN:NASA:UNITY:unity:ops:TRPSYL2ALLCRS1MGLOS___2/
# URN:NASA:UNITY:unity:ops:TRPSDL2ALLCRS1MGLOS___2
client.urn = 'URN'
client.org = 'NASA'
client.project = 'UNITY'
client.tenant = 'unity'
client.tenant_venue = 'ops'
client.collection = 'TRPSDL2ALLCRS1MGLOS'
client.collection_venue = '2'
client.collection = 'MUSES-CRS1-MGLOS'
client.collection_venue = '1'
result = client.query_granules(sort_keys='+properties.datetime,-id', limit=1000) # bbox='-114,32.5,-113,33.5'

from mdps_ds_lib.lib.utils.file_utils import FileUtils
Expand Down Expand Up @@ -374,17 +380,18 @@ def test_update_admin(self):
os.environ['TRUST_ENV'] = 'TRUE'
os.environ['TOKEN_FACTORY'] = 'COGNITO'
token_retriever: TokenAbstract = TokenFactory().get_instance(os.getenv('TOKEN_FACTORY'))
client = DsClientAdmin(token_retriever, 'https://d3vc8w9zcq658.cloudfront.net', 'am-uds-dapa')
client = DsClientAdmin(token_retriever, 'https://d2zjsabg0fonik.cloudfront.net', 'am-uds-dapa')

# URN:NASA:UNITY:UDS_LOCAL_TEST_3:DEV:DDD-01___001:test_file10
client.urn = 'URN'
client.org = 'NASA'
client.project = 'UNITY'
client.tenant = 'UDS_LOCAL_TEST_3'
client.tenant_venue = 'DEV'
client.collection = 'DDD-01'
client.collection_venue = '001'
client.add_admin_group(['CREATE', 'READ', 'DELETE'], 'wphyo')
client.tenant = 'unity'
client.tenant_venue = 'ops'
# client.collection = 'DDD-01'
# client.collection_venue = '001'
# client.add_admin_group(['CREATE', 'READ', 'DELETE'], 'wphyo')
print(client.list_admin_group())
return

def test_delete_single_granule(self):
Expand Down