Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Feature]: Add delete granule to unity_sds_client #51

Open
Tracked by #225
ngachung opened this issue Dec 20, 2024 · 4 comments
Open
Tracked by #225

[New Feature]: Add delete granule to unity_sds_client #51

ngachung opened this issue Dec 20, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@ngachung
Copy link
Contributor

DS has implemented delete granules endpoint per unity-sds/unity-data-services#484. This need to be added to unity_sds_client.

@ngachung ngachung added the enhancement New feature or request label Dec 20, 2024
@rtapella
Copy link
Contributor

Is there an issue to track the unity-sds-client portion?
(It is in the monorepo)

@mike-gangl
Copy link
Contributor

@rtapella this is the ticket for that work. References unity-sds/unity-project-management#225

@brianlee731
Copy link
Contributor

Updates here: https://github.com/unity-sds/unity-monorepo/blob/feature/unity-sds-client-update-ds-delete/libs/unity-py/unity_sds_client/services/data_service.py

For some reason, I'm getting "Forbidden" response when I call requests.delete...

Not sure what the issue is... @ngachung any thoughts?

@brianlee731
Copy link
Contributor

brianlee731 commented Jan 6, 2025

Completed.

https://github.com/unity-sds/unity-monorepo/blob/feature/unity-sds-client-update-ds-delete/libs/unity-py/unity_sds_client/services/data_service.py

Waiting on pull request.

Test Case exercised:
from unity_sds_client.unity import Unity
from unity_sds_client.unity_services import UnityServices
from unity_sds_client.unity import UnityEnvironments
from unity_sds_client.resources.collection import Collection
import requests

unity = Unity(UnityEnvironments.PROD)
token = unity._session.get_auth().get_token()
data_service = unity.client(UnityServices.DATA_SERVICE)

collections = data_service.get_collections(100)

granule_id = 'urn:nasa:unity:emit:dev:emit_ghg_test___1:emit20230809T105356_ch4_mf'

for i in range(len(collections)):
if 'urn:nasa:unity:emit:dev:emit_ghg_test___1' in collections[i].collection_id:
data_service.delete_collection_data(collections[i], granule_id)
break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants