-
Notifications
You must be signed in to change notification settings - Fork 4
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
Analysis sessions space usage #38
Comments
The following script can delete events from expired sessions in one go. from publicdb.coincidences.models import *
import datetime
now = datetime.datetime.now()
events = Event.objects.filter(coincidence__analyzedcoincidence__session__ends__lt=now)
events.delete() This might work better, but has a lot of loop overhead, but at least it should fit in memory: from publicdb.analysissessions.models import *
import datetime
now = datetime.datetime.now()
oldsessions = AnalysisSession.objects.filter(ends__lt=now)
for sessions in oldsessions:
coincidences = sessions.analyzedcoincidence_set.all()
for coinc in coincidences:
events = coinc.coincidence.events.all()
for event in events:
event.delete() |
The second method works nicely, i.e. does not crash the server. After that I optimized the table to reclaim disc space: 779M -> 137M This should be changed to happen automatically. |
Perhaps this should be rethought when #43 is finished. |
ATM the SQL dump is too big to import into a publicdb VM! A database import runs out of diskspace even after deleting the 2GB
Again |
I deleted most of the events. I used this very slow script. (The script above doesn't work anymore) from publicdb.analysissessions.models import *
all_coincidences = AnalyzedCoincidence.objects.all()
for coinc in all_coincidences:
if not coinc.session.in_progress():
events = coinc.coincidence.events.all()
for event in events:
print 'about to delete: ', event
event.delete() This deleted >800MB in
Next I vacuumed the db:
|
The coincidences events use a lot of space (probably due to their traces)
We should clean up events after they have been analysed or when a session has ended, since they will not be used again.
Except perhaps for the 'Get Example' option in jSparc, so there should always be some coincidences/events (make a couple of never ending 'ghost' sessions?)..
The text was updated successfully, but these errors were encountered: