Skip to content

Commit

Permalink
tui: add warning about using with large flows
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Feb 26, 2021
1 parent 9784733 commit 79f1e34
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
7 changes: 6 additions & 1 deletion cylc/flow/scripts/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
View and control running suites in the terminal.
(TUI = Terminal User Interface)
(Tui = Terminal User Interface)
WARNING: Tui is experimental and may break with large flows.
"""
# TODO: remove this warning once Tui is delta-driven
# https://github.com/cylc/cylc-flow/issues/3527

from textwrap import indent

from urwid import html_fragment
Expand Down
24 changes: 15 additions & 9 deletions cylc/flow/tui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_snapshot(self):
})
except (ClientError, ClientTimeout) as exc:
# catch network / client errors
self.set_header(('suite_error', str(exc)))
self.set_header([('suite_error', str(exc))])
return False

if isinstance(data, list):
Expand All @@ -331,7 +331,7 @@ def get_snapshot(self):
message = data[0]['error']['message']
except (IndexError, KeyError):
message = str(data)
self.set_header(('suite_error', message))
self.set_header([('suite_error', message)])
return False

if len(data['workflows']) != 1:
Expand All @@ -353,7 +353,7 @@ def get_node_id(node):
"""
return node.get_value()['id_']

def set_header(self, message):
def set_header(self, message: list):
"""Set the header message for this widget.
Arguments:
Expand All @@ -363,12 +363,18 @@ def set_header(self, message):
"""
# put in a one line gap
if isinstance(message, list):
message.append('\n')
elif isinstance(message, tuple):
message = (message[0], message[1] + '\n')
else:
message += '\n'
message.append('\n')

# TODO: remove once Tui is delta-driven
# https://github.com/cylc/cylc-flow/issues/3527
message.extend([
(
'suite_error',
'TUI is experimental and may break with large flows'
),
'\n'
])

self.view.header = urwid.Text(message)

def _update(self, *_):
Expand Down

0 comments on commit 79f1e34

Please sign in to comment.