tasks: Set state to 'DONE' for done tasks

... based on the file path.

Sometimes info.json is moved before the state
is set to DONE. we need to fix this in girar, but for now
we opt for a simpler workaround.
This commit is contained in:
Ivan A. Melnikov 2021-01-12 16:06:59 +04:00
parent 786d7d87a8
commit c1275e3cad

View File

@ -50,6 +50,11 @@ def load_task(task_path, cached_task=None, now=None):
with open(info_path) as f:
data = json.load(f)
# hack(iv@): sometimes info.json is moved before the state
# is set to DONE. we need to fix this in girar, but for now
# we opt for a simpler workaround:
if '/archive/done/' in task_path:
data['state'] = 'DONE'
except Exception as ex:
LOG.error("Failed to load task info from %s: %s", task_path, ex)
return cached_task