From a8820cd3ce8a847871989f641fc85e4923c023fe Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Fri, 1 Dec 2017 14:55:54 -0500 Subject: [PATCH 14/17] Syncing works, though msgs are broken --- app/league/api/views.py | 2 +- app/league/templates/admin/aga_syncing.html | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/league/api/views.py b/app/league/api/views.py index 9cd0ac6..70f57e1 100644 --- a/app/league/api/views.py +++ b/app/league/api/views.py @@ -151,7 +151,7 @@ def hello_world(): return result.wait(), 200 -@blueprint.route('/queue-aga-sync') +@blueprint.route('/queue-aga-sync', methods=['POST']) @login_required def queue_aga_sync(): """Queue AGA sync job.""" diff --git a/app/league/templates/admin/aga_syncing.html b/app/league/templates/admin/aga_syncing.html index 45c658b..0aee1d9 100644 --- a/app/league/templates/admin/aga_syncing.html +++ b/app/league/templates/admin/aga_syncing.html @@ -29,9 +29,20 @@

AGA Syncing

} $('#submit-button').click(function() { - display_msgs(['wee'], 'danger'); - display_msgs(['woo'], 'success'); - display_msgs(['waa']); + var jqxhr = $.post({ + url: '{{ url_for('api.queue_aga_sync') }}', + data: { csrf_token: csrfToken }, + success: function(data, textStatus, jqXHR) { + display_msgs(jqXHR.responseJSON, 'success'); + } + }) + .done(function(data, textStatus, jqXHR) { + display_msgs(jqXHR.responseJSON); + }) + .fail(function(data, textStatus, jqXHR) { + display_msgs(jqXHR.responseJSON, 'danger'); + }) + console.log(jqxhr); }); From d2919082e2b4ca8aa71042a05e2a1e0b01f5fa57 Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Fri, 1 Dec 2017 15:04:06 -0500 Subject: [PATCH 15/17] Fix some crap --- app/league/templates/admin/aga_syncing.html | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/league/templates/admin/aga_syncing.html b/app/league/templates/admin/aga_syncing.html index 0aee1d9..d7e4f5b 100644 --- a/app/league/templates/admin/aga_syncing.html +++ b/app/league/templates/admin/aga_syncing.html @@ -31,16 +31,13 @@

AGA Syncing

$('#submit-button').click(function() { var jqxhr = $.post({ url: '{{ url_for('api.queue_aga_sync') }}', - data: { csrf_token: csrfToken }, - success: function(data, textStatus, jqXHR) { - display_msgs(jqXHR.responseJSON, 'success'); - } + data: { csrf_token: csrfToken } }) - .done(function(data, textStatus, jqXHR) { - display_msgs(jqXHR.responseJSON); + .done(function() { + display_msgs(['Job submitted!'], 'success'); }) - .fail(function(data, textStatus, jqXHR) { - display_msgs(jqXHR.responseJSON, 'danger'); + .fail(function() { + display_msgs(['Job failed to submit!'], 'danger'); }) console.log(jqxhr); }); From 030c6ce0468138dc3113484b00ce1a52d0251161 Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Fri, 1 Dec 2017 15:12:42 -0500 Subject: [PATCH 16/17] Add debug logging to celery workers --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index dde0ada..dd58767 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,7 +46,7 @@ services: worker_1: build: ./app - command: celery -A autoapp worker + command: celery -A autoapp worker -l DEBUG depends_on: - db - queue @@ -62,7 +62,7 @@ services: worker_2: build: ./app - command: celery -A autoapp worker + command: celery -A autoapp worker -l DEBUG depends_on: - db - queue From e47ed66113856fe6ae37a1620eeb6b8696c7e5bc Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Fri, 1 Dec 2017 15:15:42 -0500 Subject: [PATCH 17/17] Fix linting errors --- app/league/app.py | 3 +-- app/league/extensions.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/league/app.py b/app/league/app.py index 7e5f6a6..dbb9e4a 100644 --- a/app/league/app.py +++ b/app/league/app.py @@ -8,8 +8,7 @@ from league import admin, api, commands, dashboard, public from league.assets import assets from league.extensions import (bcrypt, cache, celery, csrf_protect, db, - debug_toolbar, login_manager, messenger, - migrate) + debug_toolbar, login_manager, messenger, migrate) from league.public.forms import LoginForm from league.settings import ProdConfig diff --git a/app/league/extensions.py b/app/league/extensions.py index 4e4c7ee..6bedbf8 100644 --- a/app/league/extensions.py +++ b/app/league/extensions.py @@ -6,8 +6,8 @@ """ from flask_bcrypt import Bcrypt from flask_caching import Cache -from flask_debugtoolbar import DebugToolbarExtension from flask_celeryext import FlaskCeleryExt +from flask_debugtoolbar import DebugToolbarExtension from flask_login import LoginManager from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy