File tree Expand file tree Collapse file tree 3 files changed +68
-3
lines changed
Expand file tree Collapse file tree 3 files changed +68
-3
lines changed Original file line number Diff line number Diff line change 1+ # Run Celery on kubernetes
2+ apiVersion : apps/v1
3+ kind : Deployment
4+ metadata :
5+ name : editgroups-commons.celery.sh
6+ namespace : tool-editgroups-commons
7+ labels :
8+ name : editgroups-commons.celery.sh
9+ toolforge : tool
10+ spec :
11+ replicas : 1
12+ selector :
13+ matchLabels :
14+ name : editgroups-commons.celery.sh
15+ toolforge : tool
16+ template :
17+ metadata :
18+ labels :
19+ name : editgroups-commons.celery.sh
20+ toolforge : tool
21+ spec :
22+ containers :
23+ - name : celery
24+ image : docker-registry.tools.wmflabs.org/toolforge-python311-sssd-base:latest
25+ command : [ "/data/project/editgroups-commons/www/python/src/tasks-commons.sh" ]
26+ workingDir : /data/project/editgroups-commons/www/python/src
27+ env :
28+ - name : HOME
29+ value : /data/project/editgroups-commons
30+ imagePullPolicy : Always
31+ resources :
32+ requests :
33+ memory : " 512Mi"
34+ limits :
35+ memory : " 1024Mi"
Original file line number Diff line number Diff line change 11#! /bin/bash
22export GOMAXPROCS=1
3- kubectl delete deployment editgroups.celery.sh ;
3+ TOOLNAME=$( whoami | cut -d " ." -f 2)
4+ echo " Running as ${TOOLNAME} "
5+
6+ if [[ " $TOOLNAME " == " editgroups" ]]; then
7+ CELERY_FN=celery
8+ else
9+ CELERY_FN=" celery-${TOOLNAME} "
10+ fi
11+
12+ kubectl delete deployment " ${TOOLNAME} .celery.sh" ;
413echo " Waiting for Celery to stop" ;
5- sleep 45 ;
6- kubectl create -f /data/project/editgroups /www/python/src/deployment/celery .yaml && kubectl get pods
14+ sleep 45;
15+ kubectl create -f " /data/project/${TOOLNAME} /www/python/src/deployment/${CELERY_FN} .yaml"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+
4+ VENV_DIR=/data/project/editgroups-commons/www/python/venv
5+
6+ if [[ -f ${VENV_DIR} /bin/activate ]]; then
7+ source ${VENV_DIR} /bin/activate
8+ else
9+ echo " Creating virtualenv"
10+ rm -rf ${VENV_DIR}
11+ pyvenv ${VENV_DIR}
12+ source ${VENV_DIR} /bin/activate
13+ echo " Installing requirements"
14+ pip install -r requirements.txt
15+ fi ;
16+ echo " Starting celery"
17+ export C_FORCE_ROOT=True
18+ /data/project/editgroups-commons/www/python/venv/bin/python3 /data/project/editgroups-commons/www/python/venv/bin/celery --app=editgroups-commons.celery:app worker -l INFO -B --concurrency=3 --max-memory-per-child=50000
19+ echo $?
20+ echo " Celery done"
21+
You can’t perform that action at this time.
0 commit comments