mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Name docker client like mentioned in the api docs
This commit is contained in:
parent
db0c2532ad
commit
e3ceb19f7a
@ -9,7 +9,7 @@ import os
|
||||
def check_jobs():
|
||||
app = create_minimal_app(os.getenv('FLASK_CONFIG') or 'default')
|
||||
app.app_context().push()
|
||||
docker_client = docker.from_env()
|
||||
client = docker.from_env()
|
||||
jobs = db.session.query(Job)
|
||||
submitted_jobs = jobs.filter_by(status='submitted').all()
|
||||
foo_jobs = jobs.filter(Job.status != 'complete',
|
||||
@ -54,12 +54,8 @@ def check_jobs():
|
||||
' has the required ressources available (not reserved), the
|
||||
' service gets queued by the Docker engine until a node is able
|
||||
' to meet the requirements.
|
||||
'
|
||||
' TODO: The name argument should be used with the prepared value
|
||||
' (name=_name). Because there is no id generator for now, it is
|
||||
' not set, so that the Docker engine assigns a random name.
|
||||
'''
|
||||
service = docker_client.services.create(
|
||||
service = client.services.create(
|
||||
_image,
|
||||
command=_command,
|
||||
constraints=_constraints,
|
||||
@ -74,7 +70,7 @@ def check_jobs():
|
||||
'''
|
||||
' TODO: Handle service not found error.
|
||||
'''
|
||||
service = docker_client.services.get(str(job.id))
|
||||
service = client.services.get(str(job.id))
|
||||
job.status = service.tasks()[0].get('Status').get('State')
|
||||
if job.status == 'complete' or job.status == 'failed':
|
||||
job.end_date = datetime.utcnow()
|
||||
|
Loading…
Reference in New Issue
Block a user