diff --git a/esap/esap/esap_staging_config.sqlite3 b/esap/esap/esap_staging_config.sqlite3 index 4ea8b6d243a82f13c4385beeaa832c84b9d7cb48..80cfe2a2ccf30fb825676a0d3f3ad34e336551b3 100644 Binary files a/esap/esap/esap_staging_config.sqlite3 and b/esap/esap/esap_staging_config.sqlite3 differ diff --git a/esap/requirements/base.txt b/esap/requirements/base.txt index 0093e97b6b49408eb89d3b1edfc9a1c1bd9e7b42..ed9de577cb31e38f92a9be9aaf4419d44a32d679 100644 --- a/esap/requirements/base.txt +++ b/esap/requirements/base.txt @@ -10,4 +10,5 @@ requests==2.22.0 django-oidc-provider==0.7.0 django-rest-knox==4.1.0 mozilla-django-oidc==1.2.3 -celery==4.4.6 \ No newline at end of file +celery==4.4.6 +eventlet==0.24.1 \ No newline at end of file diff --git a/esap/requirements/dev.txt b/esap/requirements/dev.txt index a3e81b8dcf5c42c11a685e429d9e22bca56c471b..a9ae624cdbad60705bf4cc188bdf0b2606e0a4e1 100644 --- a/esap/requirements/dev.txt +++ b/esap/requirements/dev.txt @@ -1 +1,2 @@ -r base.txt +pypiwin32==223 \ No newline at end of file diff --git a/esap/run_celery.bat b/esap/run_celery.bat new file mode 100644 index 0000000000000000000000000000000000000000..b082b7a516622ae6e7e2d967be35abe0c2c6800b --- /dev/null +++ b/esap/run_celery.bat @@ -0,0 +1,9 @@ + +SET OIDC_RP_CLIENT_ID="fancy" +SET OIDC_RP_CLIENT_SECRET="dude" + +rem https://www.distributedpython.com/2018/08/21/celery-4-windows/#:~:text=Celery%20no%20longer%20officially%20supports,Celery%20version%20across%20your%20infrastructure. +rem celery worker -A esap.settings.dev --pool=eventlet --loglevel=INFO +celery worker -A esap.settings.dev --pool=solo --loglevel=INFO + + diff --git a/esap/run_celery_beat.bat b/esap/run_celery_beat.bat new file mode 100644 index 0000000000000000000000000000000000000000..37afe67730556d3c7cac790d27f2a3fa675d52b6 --- /dev/null +++ b/esap/run_celery_beat.bat @@ -0,0 +1,6 @@ + +SET OIDC_RP_CLIENT_ID="fancy" +SET OIDC_RP_CLIENT_SECRET="dude" + +celery beat -A esap.settings.dev --loglevel=INFO + diff --git a/esap/staging/api/urls.py b/esap/staging/api/urls.py index 09dd928aeae65afcd6a6307cf755de0f486a2cd9..283f18941b33b83f85b1e6a106a0738d95cf2b2e 100644 --- a/esap/staging/api/urls.py +++ b/esap/staging/api/urls.py @@ -15,6 +15,7 @@ urlpatterns += [ # path('admin', admin.site.urls, name='admin-view'), path('', views.IndexView.as_view(), name='index-view'), path('my_staging', views.StagingListViewAPI.as_view(), name='staging-view'), - path('staging/test', views.test_function_call, name='test') + path('staging/test', views.test_function_call, name='test'), + path('poll', views.poll_view, name='poll') ] diff --git a/esap/staging/api/views.py b/esap/staging/api/views.py index a8fa9b1e3e4505be12150165ed2259f35defeae3..c388d428b0051c6650fe158abdff478422cfa3e5 100644 --- a/esap/staging/api/views.py +++ b/esap/staging/api/views.py @@ -1,7 +1,9 @@ from django.views.generic import ListView from django_filters import rest_framework as filters +from django.http import JsonResponse + from rest_framework import viewsets, permissions, decorators, request, response, status -from staging.tasks import create_request +from staging.tasks import create_request, poll_status from staging.models import Staging, StagingRequest @@ -60,4 +62,12 @@ def test_function_call(request: request.HttpRequest): request_id = create_request(surl) return response.Response(status=status.HTTP_201_CREATED, data={'request_id': request_id}) except KeyError: - return response.Response(status=status.HTTP_400_BAD_REQUEST, data='missing parameter surl') \ No newline at end of file + return response.Response(status=status.HTTP_400_BAD_REQUEST, data='missing parameter surl') + + +def poll_view(request): + poll_status() + #return response.Response(status=status.HTTP_200_OK) + + return JsonResponse({'poll': "OK"}) + #return response.JsonResponse({'poll': "OK"}) \ No newline at end of file