summaryrefslogtreecommitdiff
path: root/src/buildstream/_frontend/widget.py
Commit message (Collapse)AuthorAgeFilesLines
* _stream.py, _frontend/widget.py: Fix weird hacktristan/fix-artifact-name-hackTristan van Berkom2020-12-111-1/+12
| | | | | | | | | When stream is asked for a list of artifacts to show for the purpose of `bst artifact show`, it was squashing the element name with the artifact name before it gets displayed in the frontend. Instead, make the special casing in the frontend.
* Restore task element name / element name distinction in UITristan van Berkom2020-10-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This behavior has regressed a while back when introducing the messenger object in 0026e379 from merge request !1500. Main behavior change: - Messages in the master log always appear with the task element's element name and cache key, even if the element or plugin issuing the log line is not the primary task element. - Messages logged in the task specific log, retain the context of the element names and cache keys which are issuing the log lines. Changes include: * _message.py: Added the task element name & key members * _messenger.py: Log the element key as well if it is provided * _widget.py: Prefer the task name & key when logging, we fallback to the element name & key in case messages are being logged outside of any ongoing task (main process/context) * job.py: Unconditionally stamp messages with the task name & key Also removed some unused parameters here, clearing up an XXX comment * plugin.py: Add new `_message_kwargs` instance property, it is the responsibility of the core base class to maintain the base keyword arguments which are to be used as kwargs for Message() instances created on behalf of the issuing plugin. Use this method to construct messages in Plugin.__message() and to pass kwargs along to Messenger.timed_activity(). * element.py: Update the `_message_kwargs` when the cache key is updated * tests/frontend/logging.py: Fix test to expect the cache key in the logline * tests/frontend/artifact_log.py: Fix test to expect the cache key in the logline Fixes #1393
* Adding _DisplayKey typeTristan van Berkom2020-10-271-6/+8
| | | | | | | | | | | | | | | | | | | Instead of passing around untyped tuples for cache keys, lets have a clearly typed object for this. This makes for more readable code, and additionally corrects the data model statement of intent that some cache keys should be displayed as "dim", instead informing the frontend about whether the cache key is "strict" or not, allowing the frontend to decide how to display a strict or non-strict key. This patch does the following: * types.py: Add _DisplayKey * element.py: Return a _DisplayKey from Element._get_display_key() * Other sources: Updated to use the display key object
* element.py: Hide dependencies which are irrelevant to the ElementTristan van Berkom2020-09-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a large breaking change, a summary of the changes are that: * The Scope type is now private, since Element plugins do not have the choice to view any other scopes. * Element.dependencies() API change Now it accepts a "selection" (sequence) of dependency elements, so that Element.dependencies() can iterate over a collection of dependencies, ensuring that we iterate over every element only once even when we need to iterate over multiple element's dependencies. The old API is moved to Element._dependencies() and still used internally. * Element.stage_dependency_artifacts() API change This gets the same treatment as Element.dependencies(), and the old API is also preserved as Element._stage_dependency_artifacts(), so that the CLI can stage things for `bst artifact checkout` and such. * Element.search() API change The Scope argument is removed, and the old API is preserved as Element._search() temporarily, until we can remove this completely.
* Element.dependencies() now yields ElementProxy wrappers by default.Tristan van Berkom2020-09-041-3/+3
| | | | | | | | | | | | | | | This prepares the ground for policing the dependencies which are visible to an Element plugin, such that plugins are only allowed to see the elements in their Scope.BUILD scope, even if they call Element.dependencies() on a dependency. This commit does the following: * Element.dependencies() is now a user facing frontend which yields ElementProxy elements instead of Elements. * Various core codepaths have been updated to call the internal Element._dependencies() codepath which still returns Elements.
* _frontend/widget.py: Refactor the Widget.print_heading() functionTristan van Berkom2020-08-101-34/+87
| | | | | | | | | | | | | This function now prints information about each loaded project in the session: * Information about each loaded project - Junction path, if any - Provenance of how the project was initially loaded, if any - Shows which projects declare the loaded project as a duplicate, if any - Shows which projects declare the loaded project as internal, if any * Plugins loaded in each project, including how they were loaded * Project option values resolved for each loaded project
* _pluginfactory: Make list_plugins() report new display informationTristan van Berkom2020-08-101-2/+2
| | | | | | | | Now the PluginFactory.list_plugins() API also reports a human readable explanation of where the plugin was loaded from for each plugin. This is internally supported by an extension of the abstract PluginOrigin.get_plugin_paths() APIs.
* _project.py: Only one set of plugin factoriesTristan van Berkom2020-08-101-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes it mandatory to specify the `plugins` configuration directly in the `project.conf`, and at the same time removes any ambiguity as to which plugins are loaded and how. It thus becomes impossible for the first pass to load the same plugins differently than in the second pass. Additionally, some additional project.conf keys are asserted to be specified in the toplevel project.conf and not included as a matter of policy and consistency. Summary of changes: * _project.py - Only one set of plugin factories, loaded only in the first pass. - Assert the following keys are only specified in project.conf and not included from other files: name, element-path, min-version, plugins - The create_element() and create_source() methods no longer need to take a `first_pass` argument * element.py: Updated to not specify `first_pass` to create_element() or create_source() * _frontend/widget.py: Print the only set of plugins which are loaded, no more ambiguity about first or second pass. * _pluginfactory/pluginoriginjunction.py: Chain load plugins from the single element/source factory, instead of accessing the Project.config member which no longer has the factories.
* Extract ElementSources classjuerg/element-sourcesJürg Billeter2020-08-061-1/+1
| | | | An ElementSources object represents the combined sources of an element.
* _frontend/widget.py: Add context to errors in `show_pipeline()`Jürg Billeter2020-08-061-15/+20
| | | | | Provide context with the element name if an error is raised when trying to determine element state.
* Optimize variable flatteningValentin David2020-06-031-1/+1
| | | | | | | | | | | | | | | | | Verifying for variables (all used variables defined and no cycle) is much faster than flattening them. It also uses much less memory. Only `bst show -f "%{vars}"` requires to flatten all variables. For other cases we can improve performance by only checking rather than flattening. Also flattening very nested variables could lead to very long lists of empty strings. The memory usage for flattening could be a lot bigger than the resulting value. Force flattening and caching every variable definitions can improve intermediate memory consumption and only consume memory of the size of the result. Finally, an optimization allowed inifinite cycles leading to segmentation fault. This was solved by simplifying the code.
* _pluginfactory: Delegating the work of locating plugins to the PluginOriginTristan van Berkom2020-05-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This way we split up the logic of how to load plugins from different origins into their respective classes. This commit also: o Introduces PluginType (which is currently either SOURCE or ELEMENT) o Reduces the complexity of the PluginFactory constructor o Kills the loaded_dependencies list and the all_loaded_plugins API, and replaces both of these with a new list_plugins() API. Consequently the jobpickler.py from the scheduler, and the widget.py from the frontend, are updated to use list_plugins(). o Split up the PluginOrigin implementations into separate files Instead of having all PluginOrigin classes in pluginorigin.py, split it up into one base class and separate files for each implementation, which is more inline with BuildStream coding style. This has the unfortunate side effect of adding load_plugin_origin() into the __init__.py file, because keeping new_from_node() as a PluginOrigin class method cannot be done without introducing a cyclic dependency with PluginOrigin and it's implementations.
* element.py: Remove _get_consistency and introduce explicit methodsBenjamin Schubert2020-01-161-4/+3
| | | | | | | This replaces the _get_consistency method by two methods: `_has_all_sources_resolved` and `_has_all_sources_cached` which allows a more fine grained control on what information is needed.
* element.py: Rename '_source_cached' to '_has_all_sources_in_source_cache'Benjamin Schubert2020-01-161-1/+1
| | | | | | '_source_cached' is not explicit enough as it doesn't distinguishes between sources in their respective caches and sources in the global sourcecache.
* _frontend/widget.py: show_pipeline() Don't show buildable for junctionTom Pollard2020-01-091-1/+3
| | | | | Instead output "junction" in magenta for info. Also include test in format/junctions.py
* Reformat code using BlackChandan Singh2019-11-141-173/+171
| | | | | | | As discussed over the mailing list, reformat code using Black. This is a one-off change to reformat all our codebase. Moving forward, we shouldn't expect such blanket reformats. Rather, we expect each change to already comply with the Black formatting style.
* _frontend: Simplify color handlingChandan Singh2019-11-121-6/+4
| | | | | | | | | | | | Currently we store color configuration in our App object, and have to remember to pass it around to `click.echo()` when printing things on the screen. This is error-prone as we can forget to do so. This leads to bugs like #1200, where `bst init` was not respecting `--no-colors` flag. Instead of doing that, this patch controls colors in output by configuring the `click.Context` object. Fixes #1200.
* Addition of --long option to list-contents:becky/list_contents_long_optionRebecca Grayson2019-09-021-5/+45
| | | | | | | | | --long or -l will provide the user with extra information about the contents of the artifacts, including permission mode, file type, size and name. In order for this to work, the way in which list-contents works has been modified. A test and NEWS entry have also been added within this commit
* _artifactcache.py: Add remote support to bst artifact showJames Ennis2019-08-271-0/+2
| | | | | | If remotes exist, each remote will be checked for the target artifacts. If an artifact is cached remotely, we make a record of this.
* cli.py: Introduce bst artifact showJames Ennis2019-08-271-0/+35
| | | | | | bst artifact show can be used to determine which element names, artifact refs (also by glob expression) are present within the artifact cache.
* Remove CASQuota and CASCacheUsageJürg Billeter2019-08-201-1/+0
|
* Addition of bst artifact list-contents:Rebecca Grayson2019-08-161-0/+33
| | | | | | | this commit introduces the bst artifact list-contents command. When used it provides the user with a list of the contents within the artifact. Tests and a NEWS entry have also been added for the command.
* _message.py: Use element_name & element_key instead of unique_idtpollard/messageobjectTom Pollard2019-08-081-23/+17
| | | | | | | | | | | | | Adding the element full name and display key into all element related messages removes the need to look up the plugintable via a plugin unique_id just to retrieve the same values for logging and widget frontend display. Relying on plugintable state is also incompatible if the frontend will be running in a different process, as it will exist in multiple states. The element full name is now displayed instead of the unique_id, such as in the debugging widget. It is also displayed in place of 'name' (i.e including any junction prepend) to be more informative.
* _yaml: remove node_sanitizeBenjamin Schubert2019-07-151-6/+4
| | | | | | | | | Some call places do not need calls to 'node_sanitize' anymore, therefore removing the call entirely. Other still use it for convenience, but that doesn't seem the right way to do it for consistency. Those places have been replaced by calls to 'Node.strip_node_info()'.
* _frontend: rm unused _line_length and Space widgetAngelos Evripiotis2019-07-091-8/+0
|
* Store core state for the frontend separatelyJonathan Maw2019-07-091-13/+18
|
* Queue: Make queues store counts of the number of skipped/processed elementsJonathan Maw2019-07-091-4/+4
| | | | | | | | We only seen to generate the list so we can get its length, so it is more efficient to only store a count of skipped/processed elements. failed_elements needs to remain a list for the moment, as it's used to retry a failed element job.
* _frontend/widget: match LogFile.render to base clsAngelos Evripiotis2019-06-181-3/+5
| | | | | | | | | Make the signature of LogFile.render() match Widget.render() by making a new LogFile.render_abbrev() method with the extra functionality. Fix up the single call site to use that instead. This means that we won't get linter warnings that helpful inform us that Widgets are not really substitutable.
* Refactor 'super(cls, self)' -> 'super()'aevri/supersuperAngelos Evripiotis2019-06-121-7/+7
| | | | | | | | | | For most use-cases with modern Python, it's not necessary to supply the 'type' or 'object-or-type' arguments to super(). Replace all our instances with arg-less super, which is less error-prone. https://docs.python.org/3.5/library/functions.html#super
* Move source from 'buildstream' to 'src/buildstream'Chandan Singh2019-05-211-0/+806
This was discussed in #1008. Fixes #1009.