Skip to content

Commit

Permalink
Tidy/fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Nov 23, 2021
1 parent 740a57b commit 5fe4209
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions cylc/uiserver/data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

from cylc.flow import ID_DELIM
from cylc.flow.network.server import PB_METHOD_MAP
from cylc.flow.network import MSG_TIMEOUT
from cylc.flow.network.subscriber import WorkflowSubscriber, process_delta_msg
from cylc.flow.data_store_mgr import (
EDGES, DATA_TEMPLATE, ALL_DELTAS, DELTAS_MAP, WORKFLOW,
Expand Down Expand Up @@ -382,24 +381,22 @@ async def entire_workflow_update(self, ids: Optional[list] = None) -> None:
results = await asyncio.gather(
*requests.values(), return_exceptions=True
)
# result:
for w_id, result in zip(requests, results):
if isinstance(result, Exception):
self.log.exception(
'Failed to update entire local data-store '
'of a workflow', exc_info=result
)
elif result is not None and result != MSG_TIMEOUT:
pb_data = PB_METHOD_MAP[req_method]()
pb_data.ParseFromString(result)
new_data = deepcopy(DATA_TEMPLATE)
for field, value in pb_data.ListFields():
if field.name == WORKFLOW:
new_data[field.name].CopyFrom(value)
new_data['delta_times'] = {
key: value.last_updated
for key in DATA_TEMPLATE
}
continue
new_data[field.name] = {n.id: n for n in value}
self.data[w_id] = new_data
pb_data = PB_METHOD_MAP[req_method]()
pb_data.ParseFromString(result)
new_data = deepcopy(DATA_TEMPLATE)
for field, value in pb_data.ListFields():
if field.name == WORKFLOW:
new_data[field.name].CopyFrom(value)
new_data['delta_times'] = {
key: value.last_updated
for key in DATA_TEMPLATE
}
continue
new_data[field.name] = {n.id: n for n in value}
self.data[w_id] = new_data

0 comments on commit 5fe4209

Please sign in to comment.