Added status field to import batch, it's synced based on jobs

This commit is contained in:
Eliot Berriot 2018-02-21 00:02:09 +01:00
parent 15bdf18705
commit 24e2555793
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
5 changed files with 97 additions and 17 deletions

View file

@ -43,3 +43,13 @@ def get_query(query_string, search_fields):
def guess_mimetype(f):
b = min(100000, f.size)
return magic.from_buffer(f.read(b), mime=True)
def compute_status(jobs):
errored = any([job.status == 'errored' for job in jobs])
if errored:
return 'errored'
pending = any([job.status == 'pending' for job in jobs])
if pending:
return 'pending'
return 'finished'