Skip to content

Commit

Permalink
add l2ss-py and concise autotest concept ids
Browse files Browse the repository at this point in the history
  • Loading branch information
James Wood authored and James Wood committed Feb 1, 2025
1 parent 305b848 commit c837a47
Showing 1 changed file with 28 additions and 34 deletions.
62 changes: 28 additions & 34 deletions hitide_collections/hitide_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,37 +325,14 @@ def list_github_files(self, repo: str, path: str, branch: str = "main"):
raise Exception(f"Failed to fetch files: {response.status_code}, {response.text}")


def add_configs(self):

s3_url = f"s3://podaac-services-{self.env}-hitide/dataset-configs"

forge_tig_config_files = self.s3.list_s3_keys(s3_url)
print(forge_tig_config_files)

short_names = [path.split("/")[1].rsplit(".", 1)[0] for path in forge_tig_config_files]
print(short_names)
def add_concept_ids(self, concept_ids):

if self.env == "ops":
mode = cmr.queries.CMR_OPS
else:
mode = cmr.queries.CMR_UAT

for short_name in short_names:
url = cmr.queries.CollectionQuery(
mode=mode).provider('POCLOUD').short_name(short_name)._build_url()

try:
collections_query = self.session.get(url, headers=self.headers, params={
'page_size': 1}).json()['feed']['entry']

self.add_collections("", collections_query)
except Exception as ex:
print(ex)
print(short_name)
pass

# Add HiTIDE UI associations
for concept_id in self.hitide_associations_text:
for concept_id in concept_ids:
print(concept_id)

try:
Expand All @@ -370,30 +347,47 @@ def add_configs(self):
print(ex)
print(concept_id)
pass


# Add l2ss-py-autotest associations
l2ss_autotest_id_files = self.list_github_files("l2ss-py-autotest", f"tests/cmr/l2ss-py/{self.env}")
print(l2ss_autotest_id_files)
def add_configs(self):

l2ss_concept_ids = [path.split("/")[-1] for path in l2ss_autotest_id_files]
print(l2ss_concept_ids)
s3_url = f"s3://podaac-services-{self.env}-hitide/dataset-configs"

forge_tig_config_files = self.s3.list_s3_keys(s3_url)
short_names = [path.split("/")[1].rsplit(".", 1)[0] for path in forge_tig_config_files]

for concept_id in l2ss_concept_ids:
print(concept_id)
if self.env == "ops":
mode = cmr.queries.CMR_OPS
else:
mode = cmr.queries.CMR_UAT

for short_name in short_names:
try:
url = cmr.queries.CollectionQuery(
mode=mode).provider('POCLOUD').concept_id(concept_id)._build_url()
mode=mode).provider('POCLOUD').short_name(short_name)._build_url()

collections_query = self.session.get(url, headers=self.headers, params={
'page_size': 1}).json()['feed']['entry']

self.add_collections("", collections_query)
except Exception as ex:
print(ex)
print(concept_id)
print(short_name)
pass

# Add HiTIDE UI .txt associations
self.add_concept_ids(self.hitide_associations_text)

# Add l2ss-py-autotest associations
l2ss_autotest_id_files = self.list_github_files("l2ss-py-autotest", f"tests/cmr/l2ss-py/{self.env}")
l2ss_concept_ids = [path.split("/")[-1] for path in l2ss_autotest_id_files]
self.add_concept_ids(l2ss_concept_ids)

# Add concise-autotest associations
concise_autotest_id_files = self.list_github_files("concise-autotest", f"tests/cmr/concise/{self.env}")
concise_concept_ids = [path.split("/")[-1] for path in concise_autotest_id_files]
self.add_concept_ids(concise_concept_ids)


def add_watches(self):

Expand Down

0 comments on commit c837a47

Please sign in to comment.