mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 09:15:41 +00:00
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
from .. import db
|
|
from ..models import Corpus, Job
|
|
import docker
|
|
|
|
|
|
docker_client = docker.from_env()
|
|
from . import corpus_utils, job_utils # noqa
|
|
|
|
|
|
def check_corpora():
|
|
corpora = Corpus.query.all()
|
|
for corpus in filter(lambda corpus: corpus.status == 'submitted', corpora):
|
|
corpus_utils.create_build_corpus_service(corpus)
|
|
for corpus in filter(lambda corpus: (corpus.status == 'queued'
|
|
or corpus.status == 'running'),
|
|
corpora):
|
|
corpus_utils.checkout_build_corpus_service(corpus)
|
|
for corpus in filter(lambda corpus: corpus.status == 'start analysis',
|
|
corpora):
|
|
corpus_utils.create_cqpserver_container(corpus)
|
|
for corpus in filter(lambda corpus: corpus.status == 'stop analysis',
|
|
corpora):
|
|
corpus_utils.remove_cqpserver_container(corpus)
|
|
db.session.commit()
|
|
|
|
|
|
def check_jobs():
|
|
jobs = Job.query.all()
|
|
for job in filter(lambda job: job.status == 'submitted', jobs):
|
|
job_utils.create_job_service(job)
|
|
for job in filter(lambda job: job.status == 'queued', jobs):
|
|
job_utils.checkout_job_service(job)
|
|
for job in filter(lambda job: job.status == 'running', jobs):
|
|
job_utils.checkout_job_service(job)
|
|
db.session.commit()
|