def result(key): print(key) result = BaseAsyncResult(key, app=tasks.celery) if result.ready(): return render_template('result.html', result=result.get()) elif result.failed(): return result.traceback else: return render_template('processing.html')
def downloads_list(request): expected_downloads = Download.objects.filter(user=request.user, status="expected") for d in expected_downloads: task = BaseAsyncResult(d.task_id) if task.ready(): if task.successful(): d.file_path = task.result d.status = 'complite' else: status = task.status pass d.save() downloads = Download.objects.filter(user=request.user).order_by('-created') return render_to_response("download_list.html", {'downloads': downloads}, context_instance=RequestContext(request))
def ajax_account_creation_done(request, task_id): result = BaseAsyncResult(task_id, CacheBackend(default_app)) if not result.ready(): return {"ok": True, "ready": False} result = result.get() return { "ok": True, "ready": True, "slug": result['slug'], "mt4_id": result['mt4_id'], "mt4_password": result['mt4_password'], "redirect": reverse("mt4_account_welcome", args=[result['slug'], result['mt4_id']]), }