[Processing tests] Delete a bundle, clean exported_bundles list.

rmnvncnt
Level 3
[Processing tests] Delete a bundle, clean exported_bundles list.

Hi, 

I am developing a python lib for bundle exporting. I am implementing tests on the bundle exporting process and I face a problem concerning the bundles_ids. 

For each test session, I start by deleting the test project : 




project_test_1_automation = automation.client.get_project('PROJECT_TEST_1')
project_test_1_automation.delete()


I then want to upload a bundle (which recreates the same project).I retrieve the exported bundles on automation thanks to :




bundles = project_test_1_automation.list_exported_bundles()['bundles']
bundle_ids = [b['bundleId'] for b in bundles]


 



And after that I check that the bundle I want to export is not in exported°bundles in order not to export an existing bundle. 



 




if bundle_name not in bundle_ids:

logging.info("Exporting {} ...".format(bundle_name))

project.export_bundle(bundle_name)


The problem is that the bundle_ids contains all the old ids that were created in the previous tests sessions. So now, it never enters the loop. 



I found that on the REST API, it's possible to export and import bundles on automation but there is no endpoints that allows to DELETE a bundle.



 

Is there a way to clean the list of exported bundles ? 

2 Replies
Alex_Combessie
Dataiker Alumni

Hi,



 



To remove a bundle created using the export_bundle method, you need to remove it from the Dataiku DATA_DIRECTORY on the server. The bundles are located in DATA_DIRECTORY_PATH/prepared_bundles/PROJECT_KEY/BUNDLE_ID.



Alternatively, you can use the get_exported_bundle_archive_stream or download_exported_bundle_archive_to_file methods to stream the bundle export, or download it to another path within the server.



Hope it helps,



Alex

0 Kudos
arielma2304
Level 3
0 Kudos

Labels

?
Labels (4)
A banner prompting to get Dataiku