Skip to content

Commit

Permalink
gc.collect after run
Browse files Browse the repository at this point in the history
  • Loading branch information
yomguy committed May 20, 2019
1 parent 12e3395 commit 6430357
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions timeside/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import mimetypes
import ast
import time
import gc
from shutil import copyfile

import timeside.core
Expand Down Expand Up @@ -398,9 +399,23 @@ def set_results_from_processor(proc, preset=None):
result.mime_type_setter(get_mime_type(result.file.path))
result.status_setter(_DONE)

if hasattr(proc, 'values'):
proc.values = None
del proc.values
if hasattr(proc, 'result'):
proc.result = None
del proc.result
if hasattr(proc, 'results'):
try:
proc.results = None
del proc.results
except:
continue
del proc

del pipe
gc.collect()

# item.lock_setter(False)


Expand Down
3 changes: 2 additions & 1 deletion timeside/server/tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

import time
import gc

from celery import shared_task
from celery.result import AsyncResult
Expand Down Expand Up @@ -31,7 +32,7 @@ def experience_run(exp_id, item_id):
item = Item.objects.get(id=item_id)
experience = Experience.objects.get(id=exp_id)
item.run(experience)

gc.collect()

@shared_task
def task_monitor(task_id, results_id):
Expand Down

0 comments on commit 6430357

Please sign in to comment.