Commit 5eab012d authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Merge branch 'master' into explicite-filename

parents 306b3471 cfab04cb
......@@ -27,6 +27,8 @@ test-docker-compose:
services:
- registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind
needs: []
when: delayed
start_in: 3 minutes
stage: test
script:
- apk update && apk upgrade && apk add jq bash curl
......
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Release.Name "celery-worker-svc" }}
labels:
{{- include "chart.labels" . | nindent 4 }}
app: celery-worker-svc
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
{{- include "chart.labels" . | nindent 4 }}
app: celery-worker
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: {{ printf "%s-%s" .Release.Name "celery" }}
labels:
......@@ -10,8 +26,12 @@ spec:
matchLabels:
{{- include "chart.selectorLabels" . | nindent 6 }}
app: celery-worker
strategy:
type: Recreate
serviceName: {{ printf "%s-%s" .Release.Name "celery-worker-svc" }}
{{- if .Values.celery.replicas }}
replicas: {{ .Values.celery.replicas }}
{{- end }}
updateStrategy:
type: RollingUpdate
template:
metadata:
{{- with .Values.podAnnotations }}
......
......@@ -33,7 +33,7 @@ Please select the traits you want to analyze jointly with the Omnibus test. A re
</template>
</v-data-table>
<div align="left" justify="start">
<v-btn depressed color="primary" v-on:click="runAnalysis()">
<v-btn depressed color="primary" v-on:click="runAnalysis()" :disabled="selectedRows.length <=1">
Launch analysis
</v-btn>
</div>
......
......@@ -29,6 +29,13 @@
<strong style="color:white; text-transform:capitalize;">{{progress}} %</strong>
</v-progress-linear>
</v-col>
<v-col
class="text-subtitle-1 text-center"
cols="12"
v-if="(activeTask == 0) || (pendingTask != 0)"
>
Task: {{activeTask}} running and {{pendingTask}} pending.
</v-col>
</v-row>
<v-row v-show="isready" align="center">
......@@ -297,6 +304,8 @@ export default {
isready: false,
isready2: false,
progress:0,
activeTask: 1,
pendingTask: 0,
gencov:null,
metadata:{"nb_phenotypes":0,"nb_snps":0},
summary:{"JASSSignif":{"MinUnivNotSignif":0,"MinUnivSignif":0},"JASSNotSignif":{"MinUnivNotSignif":0,"MinUnivSignif":0}},
......@@ -562,6 +571,12 @@ methods:{
async getStatus(){
await this.$axios.$get('/queue_status').then((function (resultStatus) {
console.log(resultStatus);
this.activeTask = resultStatus.active;
this.pendingTask = resultStatus.reserved;
}).bind(this));
await this.$axios.$get('/projects/'+this.project.id).then((async function (result) {
console.log(result.status.worktable);
......
......@@ -6,14 +6,14 @@ from json import JSONDecodeError
from pathlib import Path
from typing import List
from starlette.responses import RedirectResponse
from starlette.responses import RedirectResponse, JSONResponse
from jass import util
from jass.config import config
from jass.models.phenotype import Phenotype, get_available_phenotypes, PhenotypeIdList
from jass.models.inittable import get_inittable_meta
from jass.models.project import GlobalProject, load_project as project__load_project
from jass.tasks import create_project, run_project_analysis_if_needed
from jass.tasks import create_project, run_project_analysis_if_needed, get_queue_status
from fastapi import FastAPI, HTTPException
from fastapi.responses import Response, FileResponse
......@@ -169,6 +169,11 @@ def get_manhattan(project_id: str, selected_chr: str, selected_region: str):
)
@app.get("/api/queue_status")
def queue_status():
return JSONResponse(get_queue_status())
# @blp_inittable.route("")
......
......@@ -84,14 +84,31 @@ def dummy_task():
print("This task to nothing, but help the chain to have a valid status")
def get_queue_status():
inspect = celery.control.inspect()
workers = set()
ret = {'active': 0, 'reserved': 0}
for k in ['active', 'reserved']:
try:
for worker, queue in getattr(inspect, k)().items():
ret[k] += len(queue)
workers.add(worker)
except (
AttributeError, # when no worker
ConnectionResetError, # when rabbitMQ went down
TimeoutError, # when rabbitMQ is not reachable
):
pass
ret['worker'] = len(workers)
return ret
def run_project_analysis_if_needed(project):
if project.has_computation_going_on():
return
tasks = []
post_worktable_tasks = []
tasks.append(ensure_space_in_project_dir_task.si(project.id))
if not os.path.exists(project.get_worktable_path()):
tasks.append(create_project_worktable.si(project.id))
......@@ -110,7 +127,11 @@ def run_project_analysis_if_needed(project):
if len(tasks) + len(post_worktable_tasks) == 0:
return
main_wf = chain(
# first we check again that there is enough disk space
ensure_space_in_project_dir_task.si(project.id),
# we run the main task(s)
*tasks,
# we then compute the missing charts
group(post_worktable_tasks),
# it is mandatory to add a task that do nothing if group is used in order to have a success/failure status
dummy_task.si(),
......
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