forked from enviPath/enviPy
[Feature] Async Prediction Status Poll (#93)
Fixed #81 Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#93
This commit is contained in:
@ -1358,14 +1358,17 @@ class Pathway(EnviPathModel, AliasMixin, ScenarioMixin):
|
||||
return self.kv.get('mode', 'build') == 'predicted'
|
||||
|
||||
# Status
|
||||
def status(self):
|
||||
return self.kv.get('status', 'completed')
|
||||
|
||||
def completed(self):
|
||||
return self.kv.get('status', 'completed') == 'completed'
|
||||
return self.status() == 'completed'
|
||||
|
||||
def running(self):
|
||||
return self.kv.get('status', 'completed') == 'running'
|
||||
return self.status() == 'running'
|
||||
|
||||
def failed(self):
|
||||
return self.kv.get('status', 'completed') == 'failed'
|
||||
return self.status() == 'failed'
|
||||
|
||||
def d3_json(self):
|
||||
# Ideally it would be something like this but
|
||||
@ -1472,7 +1475,8 @@ class Pathway(EnviPathModel, AliasMixin, ScenarioMixin):
|
||||
"upToDate": True,
|
||||
"links": adjusted_links,
|
||||
"nodes": nodes,
|
||||
"modified": self.modified.strftime('%Y-%m-%d %H:%M:%S')
|
||||
"modified": self.modified.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
"status": self.status(),
|
||||
}
|
||||
|
||||
return json.dumps(res)
|
||||
|
||||
Reference in New Issue
Block a user