improved standalone tasks
This commit is contained in:
@@ -232,7 +232,8 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
|||||||
message = "Warning: This workout probably already exists in the database"
|
message = "Warning: This workout probably already exists in the database"
|
||||||
|
|
||||||
|
|
||||||
w = Workout(user=r,name=title,date=workoutdate,
|
|
||||||
|
w = Workout(user=r,name=title,date=workoutdate,
|
||||||
workouttype=workouttype,
|
workouttype=workouttype,
|
||||||
duration=duration,distance=totaldist,
|
duration=duration,distance=totaldist,
|
||||||
weightcategory=r.weightcategory,
|
weightcategory=r.weightcategory,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
if __name__ == '__main__':
|
import os
|
||||||
import django
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rowsandall_app.settings")
|
||||||
from django.conf import settings
|
|
||||||
django.setup()
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from celery import app
|
from celery import app
|
||||||
@@ -13,7 +11,7 @@ from django.contrib.auth.models import User
|
|||||||
@app.task
|
@app.task
|
||||||
@job
|
@job
|
||||||
def addcomment2(userid,id):
|
def addcomment2(userid,id):
|
||||||
print 'aap'
|
print 'aap met standalone'
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
w = Workout.objects.get(id=id)
|
w = Workout.objects.get(id=id)
|
||||||
w.notes += '\n the task has run'
|
w.notes += '\n the task has run'
|
||||||
|
|||||||
@@ -49,17 +49,6 @@ from django_rq import job
|
|||||||
import time
|
import time
|
||||||
from async_messages import message_user,messages
|
from async_messages import message_user,messages
|
||||||
|
|
||||||
@app.task
|
|
||||||
@job
|
|
||||||
def addcomment(userid,id):
|
|
||||||
time.sleep(5)
|
|
||||||
w = Workout.objects.get(id=id)
|
|
||||||
w.notes += '\n the task has run'
|
|
||||||
w.save()
|
|
||||||
u = User.objects.get(id=userid)
|
|
||||||
messages.info(u,' The task has run')
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Custom error class - to raise a NoTokenError
|
# Custom error class - to raise a NoTokenError
|
||||||
|
|||||||
Reference in New Issue
Block a user