-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #930 from matchID-project/feat/jobs-priorisation
🤴🏾 Jobs priorisation UI
- Loading branch information
Showing
12 changed files
with
2,268 additions
and
4,977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ export APP = deces-ui | |
export DATASET=fichier-des-personnes-decedees | ||
export APP_GROUP = matchID | ||
export APP_PATH := $(shell pwd) | ||
export APP_DNS=deces.matchid.io | ||
export APP_DNS?=deces.matchid.io | ||
export API_EMAIL?[email protected] | ||
export FRONTEND := ${APP_PATH} | ||
export FRONTEND_DEV_HOST = frontend-development | ||
|
@@ -110,7 +110,7 @@ export BACKEND_APP=${GIT_BACKEND} | |
export GIT_BACKEND_BRANCH ?= dev | ||
export GIT_ROOT = https://github.com/matchid-project | ||
export GIT_TOOLS = tools | ||
export API_URL?=${APP_DNS} | ||
export APP_URL?=https://${APP_DNS} | ||
export API_SSL?=1 | ||
export APP_NODES=1 | ||
export KUBE_NAMESPACE:=$(shell echo -n ${APP_GROUP}-${APP}-${GIT_BRANCH} | tr '[:upper:]' '[:lower:]' | tr '_/' '-') | ||
|
@@ -279,7 +279,7 @@ backend-config: | |
backend-dev: backend-config | ||
@echo docker-compose up backend dev | ||
@${MAKE} -C ${APP_PATH}/${GIT_BACKEND} dev DC_NETWORK=${DC_NETWORK} GIT_BRANCH=${GIT_BACKEND_BRANCH}\ | ||
API_URL=${API_URL} API_EMAIL=${API_EMAIL} API_SSL=${API_SSL}\ | ||
APP_URL=http://localhost:${PORT} API_URL=http://localhost:${PORT} API_EMAIL=${API_EMAIL} API_SSL=${API_SSL}\ | ||
BACKEND_JOB_CONCURRENCY=${BACKEND_JOB_CONCURRENCY} BACKEND_CHUNK_CONCURRENCY=${BACKEND_CHUNK_CONCURRENCY}\ | ||
BACKEND_TOKEN_USER=${BACKEND_TOKEN_USER} BACKEND_TOKEN_KEY=${BACKEND_TOKEN_KEY} BACKEND_TOKEN_PASSWORD=${BACKEND_TOKEN_PASSWORD}\ | ||
BACKEND_TMP_MAX=${BACKEND_TMP_MAX} BACKEND_TMP_DURATION=${BACKEND_TMP_DURATION} BACKEND_TMP_WINDOW=${BACKEND_TMP_WINDOW} | ||
|
@@ -297,7 +297,7 @@ backend-docker-check: backend-config | |
backend: backend-config backend-docker-check proofs-mount elasticsearch-index-readiness | ||
@BACKEND_APP_VERSION=$(shell cd ${APP_PATH}/${GIT_BACKEND} && git describe --tags);\ | ||
${MAKE} -C ${APP_PATH}/${GIT_BACKEND} backend-start APP=deces-backend DC_NETWORK=${DC_NETWORK} APP_VERSION=$$BACKEND_APP_VERSION GIT_BRANCH=${GIT_BACKEND_BRANCH}\ | ||
API_URL=${API_URL} API_EMAIL=${API_EMAIL} API_SSL=${API_SSL}\ | ||
APP_URL=${APP_URL} API_URL=${API_URL} API_EMAIL=${API_EMAIL} API_SSL=${API_SSL}\ | ||
BACKEND_JOB_CONCURRENCY=${BACKEND_JOB_CONCURRENCY} BACKEND_CHUNK_CONCURRENCY=${BACKEND_CHUNK_CONCURRENCY}\ | ||
BACKEND_TOKEN_USER=${BACKEND_TOKEN_USER} BACKEND_TOKEN_KEY=${BACKEND_TOKEN_KEY} BACKEND_TOKEN_PASSWORD=${BACKEND_TOKEN_PASSWORD}\ | ||
BACKEND_TMP_MAX=${BACKEND_TMP_MAX} BACKEND_TMP_DURATION=${BACKEND_TMP_DURATION} BACKEND_TMP_WINDOW=${BACKEND_TMP_WINDOW} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
export const validColumns = [ | ||
'lastName', | ||
'legalName', | ||
'sex', | ||
'birthDate', | ||
'birthCity', | ||
'birthDepartment', | ||
'birthCountry', | ||
'deathDate', | ||
'deathCity', | ||
'deathDepartment', | ||
'deathCountry', | ||
'lastSeenAliveDate' | ||
]; | ||
|
||
export const getJobsData = async (accessToken) => { | ||
const headers = { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
} | ||
let response = await fetch('__BACKEND_PROXY_PATH__/queue/jobs', headers); | ||
const list = (await response.json()).jobs || []; | ||
return list | ||
} | ||
|
||
export const getJobsFilteredData = async (accessToken) => { | ||
const list = await getJobsData(accessToken); | ||
const tmpJobs = []; | ||
list.forEach(j => { | ||
const delay = ( | ||
(j.finishedOn ? j.finishedOn : Math.floor(Date.now())) | ||
- j.processedOn | ||
) / 1000; | ||
const progress = j.status && j.status === "completed" ? | ||
"100" : j.progress && j.progress.percentage ? | ||
Math.round(j.progress.percentage) : 0 | ||
tmpJobs.push({ | ||
rows: j.data.totalRows, | ||
id: j.id, | ||
user: j.data && j.data.user, | ||
date: j.timestamp, | ||
status: j.status, | ||
waiting_time: j.processedOn && (j.processedOn - j.timestamp) / 1000, | ||
processing_time: delay, | ||
columns: validColumns.filter(c => j.data && j.data[c]), | ||
processing_rate: j.processedOn && Math.floor((progress / 100) * (j.data.totalRows / delay)), | ||
finishedOnTime: j.finishedOn ? dateTostr(new Date(j.finishedOn)) : 'en cours', | ||
deletionTime: j.status === 'completed' ? dateTostr(new Date(j.finishedOn + (j.data.tmpfilePersistence || 3600000))) : (j.status === 'failed' ? dateTostr(new Date(j.finishedOn)) : 'en cours'), | ||
link: (['active', 'created', 'waiting', 'wait'].includes(j.status) || j.status === 'completed' && j.finishedOn && (Date.now() < new Date(j.finishedOn + (j.data.tmpfilePersistence || 3600000)))) ? `/link?job=${j.data.randomKey}` : undefined, | ||
progress: progress | ||
})}); | ||
return tmpJobs.sort((a,b) => (b.date - a.date)).map(j => { | ||
j.date= dateTostr(new Date(j.date)); | ||
return j; | ||
}); | ||
} | ||
|
||
|
||
export const getJobData = async (accessToken, linkJob) => { | ||
const jobs = await getJobsData(accessToken); | ||
return jobs.find(j => j.data && j.data.randomKey && j.data.randomKey === linkJob); | ||
} | ||
|
||
const dateTostr = (_date) => { | ||
const pad = (num) => num.toString().padStart(2, '0'); | ||
return `${_date.getFullYear()}-${pad(_date.getMonth() + 1)}-${pad(_date.getDate())} ${pad(_date.getHours())}:${pad(_date.getMinutes())}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.