This is an automated email from the ASF dual-hosted git repository. not-in-ldap pushed a commit to branch tpollard/buildsubtemp in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit c357eddbc4af3428632cfb8ad9e5ceb9aeb710db Author: Tom Pollard <[email protected]> AuthorDate: Tue Oct 29 12:52:27 2019 +0000 Lint fixes --- src/buildstream/_exceptions.py | 3 +++ src/buildstream/_scheduler/scheduler.py | 6 +++--- src/buildstream/_state.py | 3 ++- src/buildstream/_stream.py | 30 ++++++++++++++++-------------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/buildstream/_exceptions.py b/src/buildstream/_exceptions.py index 1468381..0ced045 100644 --- a/src/buildstream/_exceptions.py +++ b/src/buildstream/_exceptions.py @@ -43,6 +43,7 @@ def get_last_exception(): _last_exception = None return le + # set_last_exception() # # Sets the last exception from the main process, used if Stream is running a subprocess @@ -52,6 +53,7 @@ def set_last_exception(exception): global _last_exception _last_exception = exception + # get_last_task_error() # # Fetches the last exception from a task @@ -389,6 +391,7 @@ class ArtifactElementError(BstError): def __init__(self, message, *, detail=None, reason=None): super().__init__(message, detail=detail, domain=ErrorDomain.ELEMENT, reason=reason) + class SubprocessException(BstError): def __init__(self, **kwargs): super().__init__(kwargs['message'], detail=kwargs['detail'], diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py index b6539f6..cdf1d5a 100644 --- a/src/buildstream/_scheduler/scheduler.py +++ b/src/buildstream/_scheduler/scheduler.py @@ -97,7 +97,7 @@ class Notification(): exception=None, task_groups=None, element_totals=None, - show_pipeline = None): + show_pipeline=None): self.notification_type = notification_type self.full_name = full_name self.job_action = job_action @@ -107,9 +107,9 @@ class Notification(): self.message = message self.task_error = task_error # Tuple of domain & reason self.exception = exception - self.task_groups = task_groups # Tuple of queue name, complete name, task change, & optional element name + self.task_groups = task_groups # Tuple of queue name, complete name, task change, & optional element name self.element_totals = element_totals - self.show_pipeline = show_pipeline # Output of LogLine.show_pipeline() cb, to represent pipeline state + self.show_pipeline = show_pipeline # Output of LogLine.show_pipeline() cb, to represent pipeline state # Scheduler() diff --git a/src/buildstream/_state.py b/src/buildstream/_state.py index f35f07a..d78850f 100644 --- a/src/buildstream/_state.py +++ b/src/buildstream/_state.py @@ -89,6 +89,8 @@ class TaskGroup(): # If name matches group, or if name not given call the cb if name == self.name or name is None: cb(name, self.complete_name, 'failed_tasks', full_name) + + # State # # The state data that is stored for the purpose of sharing with the frontend. @@ -258,7 +260,6 @@ class State(): def unregister_task_groups_changed_callback(self, callback, name=None): self._task_groups_changed_cbs.remove((callback, name)) - ############################################## # Core-facing APIs for driving notifications # ############################################## diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 61a8322..21c5410 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -35,7 +35,8 @@ from contextlib import contextmanager, suppress from fnmatch import fnmatch from ._artifactelement import verify_artifact_ref, ArtifactElement -from ._exceptions import StreamError, ImplError, BstError, ArtifactElementError, ArtifactError, set_last_task_error, SubprocessException, set_last_exception +from ._exceptions import StreamError, ImplError, BstError, ArtifactElementError, ArtifactError, set_last_task_error, \ + SubprocessException, set_last_exception from ._message import Message, MessageType from ._scheduler import Scheduler, SchedStatus, TrackQueue, FetchQueue, \ SourcePushQueue, BuildQueue, PullQueue, ArtifactPushQueue, NotificationType, Notification, JobStatus @@ -346,17 +347,16 @@ class Stream(): if remote: use_config = False - elements, track_elements = \ self._load(targets, track_targets, - selection=selection, track_selection=PipelineSelection.ALL, - track_except_targets=track_except, - track_cross_junctions=track_cross_junctions, - ignore_junction_targets=ignore_junction_targets, - use_artifact_config=use_config, - artifact_remote_url=remote, - use_source_config=True, - dynamic_plan=True) + selection=selection, track_selection=PipelineSelection.ALL, + track_except_targets=track_except, + track_cross_junctions=track_cross_junctions, + ignore_junction_targets=ignore_junction_targets, + use_artifact_config=use_config, + artifact_remote_url=remote, + use_source_config=True, + dynamic_plan=True) # Remove the tracking elements from the main targets elements = self._pipeline.subtract_elements(elements, track_elements) @@ -1457,9 +1457,9 @@ class Stream(): self._notify_front(Notification(NotificationType.ELEMENT_TOTALS, element_totals=element_totals)) - # Also send through the pipeline renderer output for heading & summary rendering - total_pipeline_render = self._pipeline_render_callback(self.total_elements, self._context.log_element_format) # pylint: disable=not-callable + total_pipeline_render = self._pipeline_render_callback(self.total_elements, # pylint: disable=not-callable + self._context.log_element_format) self._notify_front(Notification(NotificationType.SHOW_PIPELINE, show_pipeline=total_pipeline_render)) if self._session_start_callback is not None: @@ -1861,8 +1861,10 @@ class Stream(): def _connect_signals(self): if self.loop: self.loop.add_signal_handler(signal.SIGINT, self._interrupt_callback) - self.loop.add_signal_handler(signal.SIGTERM, lambda: self._notify_back(Notification(NotificationType.TERMINATE))) - self.loop.add_signal_handler(signal.SIGTSTP, lambda: self._notify_back(Notification(NotificationType.SIGTSTP))) + self.loop.add_signal_handler(signal.SIGTERM, + lambda: self._notify_back(Notification(NotificationType.TERMINATE))) + self.loop.add_signal_handler(signal.SIGTSTP, + lambda: self._notify_back(Notification(NotificationType.SIGTSTP))) def _disconnect_signals(self): if self.loop:
