Commit bbde253f authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

update README and try to restore celery worker on kubernetes

parent 126032cf
Pipeline #35260 passed with stages
in 3 minutes and 46 seconds
...@@ -14,4 +14,4 @@ It is composed of both an API and a client side for visualization and interactio ...@@ -14,4 +14,4 @@ It is composed of both an API and a client side for visualization and interactio
## Wiki & Documentation ## Wiki & Documentation
For more information, please have a look at our [Wiki](https://gitlab.pasteur.fr/metagenomics/metagenedb/-/wikis/MetageneDB) For more information, please have a look at our [Wiki](https://gitlab.pasteur.fr/metagenomics/metagenedb/-/wikis/home)
...@@ -4,7 +4,7 @@ from rest_framework.routers import DefaultRouter, DynamicRoute, Route ...@@ -4,7 +4,7 @@ from rest_framework.routers import DefaultRouter, DynamicRoute, Route
from metagenedb.api.catalog import views from metagenedb.api.catalog import views
# from metagenedb.api.catalog.views.celery_test import celery_test_view, test_task_view from metagenedb.api.catalog.views.celery_test import test_task_view
class CustomRouter(DefaultRouter): class CustomRouter(DefaultRouter):
...@@ -66,6 +66,5 @@ api_router.register(r'statistics', views.StatisticsViewSet, basename='statistics ...@@ -66,6 +66,5 @@ api_router.register(r'statistics', views.StatisticsViewSet, basename='statistics
urlpatterns = [ urlpatterns = [
url(r'v1/', include((api_router.urls, 'v1'))), url(r'v1/', include((api_router.urls, 'v1'))),
path('admin/', include(('metagenedb.api.catalog.admin_urls', 'admin'))), path('admin/', include(('metagenedb.api.catalog.admin_urls', 'admin'))),
# path('celery-test/', celery_test_view, name='celery-test'), path('celery-task-test/', test_task_view, name='celery-task-test'),
# path('celery-task-test/', test_task_view, name='celery-task-test'),
] ]
...@@ -4,17 +4,9 @@ from celery.decorators import task ...@@ -4,17 +4,9 @@ from celery.decorators import task
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
from rest_framework.response import Response from rest_framework.response import Response
from metagenedb.celery_app import debug_task
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@api_view()
def celery_test_view(request):
debug_task.delay()
return Response({"message": "Your task is being processed!"})
@task(name="test_celery_task") @task(name="test_celery_task")
def test_task(msg): def test_task(msg):
logger.info("Test Celery Task") logger.info("Test Celery Task")
...@@ -28,6 +20,6 @@ def mul(x, y): ...@@ -28,6 +20,6 @@ def mul(x, y):
@api_view() @api_view()
def test_task_view(request): def test_task_view(request):
msg = test_task.delay("poooouet") msg = test_task.delay("pirooooouettee")
muli = mul.delay(2, 4) muli = mul.delay(2, 4)
return Response({"message": f"Tested celery task: {msg.get(timeout=1)} {muli.get(timeout=1)}"}) return Response({"message": f"Tested celery task: {msg.get(timeout=1)} {muli.get(timeout=1)}"})
...@@ -23,12 +23,10 @@ def empty_db(): ...@@ -23,12 +23,10 @@ def empty_db():
def create_taxonomy_db(): def create_taxonomy_db():
Taxonomy.objects.all().delete()
gen_tax_db() gen_tax_db()
def create_genes_db(): def create_genes_db():
Gene.objects.all().delete()
GeneFactory.create_batch(50) GeneFactory.create_batch(50)
GeneWithEggNOGFactory.create_batch(15) GeneWithEggNOGFactory.create_batch(15)
GeneWithKeggFactory.create_batch(12) GeneWithKeggFactory.create_batch(12)
......
...@@ -12,8 +12,3 @@ app.conf.beat_schedule = { ...@@ -12,8 +12,3 @@ app.conf.beat_schedule = {
'schedule': 20.0 'schedule': 20.0
}, },
} }
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
...@@ -27,7 +27,7 @@ kubectl -n ${NAMESPACE} wait --for=condition=available --timeout=600s deployment ...@@ -27,7 +27,7 @@ kubectl -n ${NAMESPACE} wait --for=condition=available --timeout=600s deployment
envsubst < ci/kubernetes/backend.yaml | kubectl apply -n ${NAMESPACE} -f - envsubst < ci/kubernetes/backend.yaml | kubectl apply -n ${NAMESPACE} -f -
kubectl -n ${NAMESPACE} patch deployment backend -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}" kubectl -n ${NAMESPACE} patch deployment backend -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
## Celery worker ## Celery worker
# envsubst < ci/kubernetes/celery-worker.yaml | kubectl apply -n ${NAMESPACE} -f - envsubst < ci/kubernetes/celery-worker.yaml | kubectl apply -n ${NAMESPACE} -f -
## Frontend ## Frontend
envsubst < ci/kubernetes/frontend.yaml | kubectl apply -n ${NAMESPACE} -f - envsubst < ci/kubernetes/frontend.yaml | kubectl apply -n ${NAMESPACE} -f -
kubectl -n ${NAMESPACE} patch deployment frontend -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}" kubectl -n ${NAMESPACE} patch deployment frontend -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment