Interactive bst operations fail with open workspaces
Summary
When doing any bst operations involving an element with open workspace, BuildStream throws an AssertionError. Interestingly, this only happens when running bst interactively (i.e. when attached to a tty).
This is probably a regression introduced by the "Workspaces via CAS" effort.
Steps to reproduce
# Clone https://gitlab.com/BuildStream/buildstream and cd into it
#
cd tests/frontend/project
bst workspace open import-bin.bst --directory dir
bst show import-bin.bst
# Watch bst throw an assertion error
# Included stack trace at the bottom
# Funnily enough, the following command succeeds
bst show imort-bin.bst | tee
# All good!
What is the current bug behavior?
bst throws assertion errors when running any commands on a workspaced element.
What is the expected correct behavior?
We don't get an assertion error and the command succeeds.
Relevant logs and/or screenshots
# Bad
/src/tests/frontend/project> bst show import-bin.bst
[--:--:--][ ][ main:core activity ] START Loading elements
[00:00:00][ ][ main:core activity ] SUCCESS Loading elements
[--:--:--][ ][ main:core activity ] START Resolving elements
[00:00:00][ ][ main:core activity ] SUCCESS Resolving elements
[--:--:--][ ][ main:core activity ] START Resolving cached state
[--:--:--][ ][ main:core activity ] BUG
Traceback (most recent call last):
File "/usr/local/bin/bst", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/src/src/buildstream/_frontend/cli.py", line 244, in override_main
standalone_mode=standalone_mode, **extra)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 27, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/src/src/buildstream/_frontend/cli.py", line 537, in show
except_targets=except_)
File "/src/src/buildstream/_stream.py", line 151, in load_selection
load_refs=load_refs)
File "/src/src/buildstream/_stream.py", line 1283, in _load
self._pipeline.resolve_elements(self.targets)
File "/src/src/buildstream/_pipeline.py", line 163, in resolve_elements
task.add_current_progress()
File "/src/src/buildstream/_state.py", line 407, in add_current_progress
self.set_current_progress(new_progress)
File "/src/src/buildstream/_state.py", line 392, in set_current_progress
self._render_cb()
File "/src/src/buildstream/_messenger.py", line 424, in _render_status
self._render_status_cb()
File "/src/src/buildstream/_frontend/app.py", line 503, in _maybe_render_status
self._status.render()
File "/src/src/buildstream/_frontend/status.py", line 141, in render
text = self._header.render(self._term_width, elapsed)
File "/src/src/buildstream/_frontend/status.py", line 422, in render
usage = cas.get_cache_usage()
File "/src/src/buildstream/_cas/cascache.py", line 1049, in get_cache_usage
self._cache_usage_monitor = _CASCacheUsageMonitor(self)
File "/src/src/buildstream/_cas/cascache.py", line 1112, in __init__
assert utils._is_single_threaded() and not cas.has_open_grpc_channels()
AssertionError
# Good
/src/tests/frontend/project> bst show import-bin.bst | tee
[--:--:--][ ][ main:core activity ] START Loading elements
[00:00:00][ ][ main:core activity ] SUCCESS Loading elements
[--:--:--][ ][ main:core activity ] START Resolving elements
[00:00:00][ ][ main:core activity ] SUCCESS Resolving elements
[--:--:--][ ][ main:core activity ] START Resolving cached state
[00:00:01][ ][ main:core activity ] SUCCESS Resolving cached state
cached 6c44373cb1ad54802520e6dbea14bedaa2f52f1db33cda96598cadd901d191a2 import-bin.bst Workspace: /src/tests/frontend/project/dir