-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement deletion policy #464
Conversation
f307169
to
adf3e6a
Compare
Move metadata of a request (of a sketch map) to the map frame table instead of in the blob (uploaded files) table.
move test from test_celery_tasks.py to test_database_client_celery.py
b861281
to
f5a44ad
Compare
create_query = """ | ||
CREATE TABLE IF NOT EXISTS blob( | ||
id SERIAL PRIMARY KEY, | ||
uuid UUID, |
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.
rename to something like map_frame_uuid
or map_uuid
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.
done
|
||
Only set file and name to null. Keep metadata. | ||
""" | ||
# TODO: Wait one day until deletion or check celery task status? |
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.
either implement ts interval of 24 hours or delete only for one uuid
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.
Implemented delete by map frame uuid.
@@ -17,6 +17,16 @@ class Bbox: | |||
lon_max: float | |||
lat_max: float | |||
|
|||
@property |
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.
add test function
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.
done
sketch_map_tool/tasks.py
Outdated
def cleanup_map_frames(): | ||
"""Cleanup map frames stored in the database.""" | ||
db_client_celery.cleanup_map_frames() | ||
# TODO: run Vacuum or Vacuum full? |
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.
resolve before merging
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.
Autovacuum should be enabled by default. Check first. If so, this should be enough.
Re-create VCR cassettes with out exchanging image in body against a dummy image. Use git lfs.
instead of string
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.
some recommendations:
- mock arcgis request in
definitions.py
- remove
.gitattributes
- link config.py (defaults) in documentation
All of those has been addressed. |
Todo:
should Bbox class have from string (from wkt function)?Fix tests by setup database on each run (not just on writing into the database)This PR implements two cleanup functions as well as stores more metadata in the database:
cleanup_map_frames
: Cleanup of old map frames for which there are uploaded sketch maps without consent. This cleanup is executed by celery beat every hour.cleanup_blobs
: Cleanup of uploaded sketch maps without consent after vector and raster results are generated. This cleanup is executed as callback by celery after uploaded sketch maps are processed.Possible improvements:
client_celery.select_file
call intasks.py
should return not only the file but alsolayer
andbbox
. This would enable to load those only at the place needed and not inroutes.py
and pass it totasks.py
. (locality of behaviour)select_file()
to a more specific name since it does not only return fileCloses #447