Private
Public Access
1
0

Merge branch 'release/v4.79'

This commit is contained in:
Sander Roosendaal
2017-11-02 08:41:52 +01:00
4 changed files with 27 additions and 6 deletions

View File

@@ -916,7 +916,10 @@ def handle_nonpainsled(f2, fileformat, summary=''):
f_to_be_deleted = f2 f_to_be_deleted = f2
# should delete file # should delete file
f2 = f2[:-4] + 'o.csv' f2 = f2[:-4] + 'o.csv'
row.write_csv(f2, gzip=True) try:
row.write_csv(f2, gzip=True)
except:
return (0,0,0,0)
# os.remove(f2) # os.remove(f2)
try: try:
@@ -1009,6 +1012,9 @@ def new_workout_from_file(r, f2,
f2, summary, oarlength, inboard = handle_nonpainsled(f2, f2, summary, oarlength, inboard = handle_nonpainsled(f2,
fileformat, fileformat,
summary=summary) summary=summary)
if not f2:
message = 'Something went wrong'
return (0, message, '')
except: except:
errorstring = str(sys.exc_info()[0]) errorstring = str(sys.exc_info()[0])
message = 'Something went wrong: ' + errorstring message = 'Something went wrong: ' + errorstring

View File

@@ -13,6 +13,7 @@ import threading
import requests import requests
from rowsandall_app.settings import SITE_URL from rowsandall_app.settings import SITE_URL
from rowsandall_app.settings_dev import SITE_URL as SITE_URL_DEV
def getvalue(data): def getvalue(data):
perc = 0 perc = 0
@@ -73,7 +74,11 @@ def longtask2(aantal,jobid=None,debug=False):
if debug: if debug:
print progress print progress
if jobid != None: if jobid != None:
url = SITE_URL+"/rowers/record-progress/" if debug:
url = SITE_URL_DEV
else:
url = SITE_URL
url += "/rowers/record-progress/"
url += str(progress)+"/"+jobid url += str(progress)+"/"+jobid
s = requests.get(url) s = requests.get(url)
if debug: if debug:

View File

@@ -53,10 +53,17 @@ def long_test_task(self,aantal,debug=False,job=None,session_key=None):
session_key=session_key) session_key=session_key)
@app.task(bind=True) @app.task(bind=True)
def long_test_task2(self,aantal,debug=False,job=None): def long_test_task2(self,aantal,**kwargs):
#debug=False,job=None,jobid='aap'):
job = self.request job = self.request
job_id = job.id
return longtask.longtask2(aantal,jobid=job.id,debug=debug)
if 'jobkey' in kwargs:
job_id = kwargs.pop('jobkey')
kwargs['jobid'] = job_id
return longtask.longtask2(aantal,**kwargs)
# create workout # create workout
@app.task @app.task

View File

@@ -4,7 +4,7 @@ import pandas as pd
import colorsys import colorsys
from django.conf import settings from django.conf import settings
import uuid
lbstoN = 4.44822 lbstoN = 4.44822
@@ -224,6 +224,9 @@ def myqueue(queue,function,*args,**kwargs):
kwargs['debug'] = True kwargs['debug'] = True
job = function.delay(*args,**kwargs) job = function.delay(*args,**kwargs)
else: else:
job_id = str(uuid.uuid4())
kwargs['job_id'] = job_id
kwargs['jobkey'] = job_id
job = queue.enqueue(function,*args,**kwargs) job = queue.enqueue(function,*args,**kwargs)
return job return job