Skip to content

Commit

Permalink
set a maximum expiration for tasks to 2 days
Browse files Browse the repository at this point in the history
  • Loading branch information
jokedurnez committed Mar 21, 2017
1 parent fd10477 commit 8b23071
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
19 changes: 19 additions & 0 deletions neuropower/.sync-config.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
remote:
host: "aws"
user: "ec2-user"
path: "/home/ec2-user/neuropower-web/neuropower"
behaviour:
uploadOnSave: false
syncDownOnOpen: false
forgetConsole: false
autoHideConsole: true
alwaysSyncAll: false
option:
deleteFiles: false
exclude: [
".sync-config.cson"
".git"
"node_modules"
"tmp"
"vendor"
]
6 changes: 5 additions & 1 deletion neuropower/apps/designtoolbox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import StringIO
import shutil
import urllib2
import datetime as dt
from datetime import datetime
from celery import task
from celery.task.control import revoke, inspect
Expand Down Expand Up @@ -590,7 +591,10 @@ def runGA(request):
else:
desdata = DesignModel.objects.filter(SID=sid).last()
runform = DesignRunForm(None, instance=desdata)
res = GeneticAlgorithm.delay(sid)
#maximum queue: 2 days
expires = int(2 * 24 * 60.)

res = GeneticAlgorithm.apply_async(args=[sid],expires=expires)
form = runform.save(commit=False)
form.taskID = res.task_id
form.timestamp = str(datetime.now())
Expand Down

0 comments on commit 8b23071

Please sign in to comment.