Skip to content

Commit

Permalink
Feature/limit automation collection (#64)
Browse files Browse the repository at this point in the history
* limit to 3 collection tested each time

* update comments

* raise excecption when removing from cmr fails
  • Loading branch information
sliu008 authored Jul 12, 2023
1 parent 16108f6 commit 21e43c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion remove_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,19 @@ def run():

with open(collection_json) as afile:
assoc_concept_ids = afile.readlines()
exception_happen = False
failed_remove = []
for i, assoc_concept_id in enumerate(assoc_concept_ids):
collection_concept_id = assoc_concept_id.strip('\n')
print(f"Removing {collection_concept_id} from CMR association")
resp = create_assoc.remove_association(url_prefix, service_concept_id, collection_concept_id, header)
print(f'Response: {resp}')
if resp.status_code != 200:
exception_happen = True
failed_remove.append(assoc_concept_ids)
if exception_happen:
print(failed_remove)
raise Exception("Failure to remove a collection from CMR")

if __name__ == '__main__':
run()
run()

0 comments on commit 21e43c8

Please sign in to comment.