-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: Remove unused aspects assets on import #950
Conversation
2565988
to
6105f5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, can you update the PR description with exactly what the changes are and put something in the readme about the new command? I don't think the old commands are in there anywhere but can you spin through and make sure?
tutoraspects/templates/aspects/apps/superset/pythonpath/create_assets_utils.py
Outdated
Show resolved
Hide resolved
tutoraspects/templates/aspects/apps/superset/pythonpath/aspects_asset_list.yaml
Outdated
Show resolved
Hide resolved
for id in id_list: | ||
tag_command = DeleteTaggedObjectCommand(OBJECT_TYPES[asset_type], id) | ||
tag_command.run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary as per Superset 4.0.2, and on Superset 4.1.0 this should happen automatically by the backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does happen automatically, but if there are multiple tag rows per object (which there are locally at least) then it fails. I created an issue in the superset repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - this will be fixed in the 4.1 superset release so we need to keep this code in for now
...tes/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_8b0535.yaml
Outdated
Show resolved
Hide resolved
499375d
to
fe08281
Compare
tutoraspects/templates/aspects/apps/superset/pythonpath/create_assets.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worked for me! Thanks for all the work on this!
Closes #370
create_assets.py
- run during init and import-assetswrite to yaml file every uuid and it's translated asset uuids
delete_assets.py
- called within create_assetsfor each uuid in aspects_asset_list 'unused' and their corresponding translated uuids, DELETE assets from superset db
delete_aspects_unused_assets.py
- run during 'import_superset_zip' and 'check_superset_assets'if chart/dataset is not used AND is in aspects_asset_list under 'unused', DELETE yaml file
if chart/dataset is not used (ignoring any uuid listed under 'ignored' in aspects_asset_list.yaml) print warning about potential unused assets
Remove duplicate name check - not needed anymore since we append uuid to filename