mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 11:24:18 +00:00
24 lines
699 B
Python
24 lines
699 B
Python
from app import db
|
|
from flask import current_app
|
|
from time import sleep
|
|
from .corpus_utils import CheckCorporaMixin
|
|
from .job_utils import CheckJobsMixin
|
|
import docker
|
|
|
|
|
|
class Daemon(CheckCorporaMixin, CheckJobsMixin):
|
|
def __init__(self):
|
|
self.docker = docker.from_env()
|
|
self.docker.login(
|
|
username=current_app.config['NOPAQUE_DOCKER_REGISTRY_USERNAME'],
|
|
password=current_app.config['NOPAQUE_DOCKER_REGISTRY_PASSWORD'],
|
|
registry=current_app.config['NOPAQUE_DOCKER_REGISTRY']
|
|
)
|
|
|
|
def run(self):
|
|
while True:
|
|
self.check_corpora()
|
|
self.check_jobs()
|
|
db.session.commit()
|
|
sleep(1.5)
|