This is an automated email from the ASF dual-hosted git repository. root pushed a commit to branch tpollard/notificationhandlertmp in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 998fd07484c609e325ea9d533c7a2358cbe8d41a Author: Tom Pollard <[email protected]> AuthorDate: Tue Aug 6 16:28:39 2019 +0100 fixups --- src/buildstream/_scheduler/scheduler.py | 27 ++++++++++----------------- src/buildstream/_stream.py | 7 ++----- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py index 2820c28..e2a180c 100644 --- a/src/buildstream/_scheduler/scheduler.py +++ b/src/buildstream/_scheduler/scheduler.py @@ -279,30 +279,23 @@ class Scheduler(): # queue (Queue): The Queue holding a complete job # job (Job): The completed Job # status (JobStatus): The status of the completed job - # process_jobs (bool): If the scheduler should also process the - # job, else just generate the notification # - def job_completed(self, job, status, process_jobs=True): - - if process_jobs: - # Remove from the active jobs list - self._active_jobs.remove(job) + def job_completed(self, job, status): + self._active_jobs.remove(job) + element = None if status == JobStatus.FAIL: # If it's an elementjob, we want to compare against the failure messages # and send the Element() instance. Note this will change if the frontend # is run in a separate process for pickling element = job.get_element() - message = Notification(NotificationType.JOB_COMPLETE, - full_name=job.name, - job_action=job.action_name, - job_status=status, - element=element) - self.message(message) - - if process_jobs: - # Now check for more jobs - self._sched() + notification = Notification(NotificationType.JOB_COMPLETE, + full_name=job.name, + job_action=job.action_name, + job_status=status, + element=element) + self.notify(notification) + self._sched() # check_cache_size(): # diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index b09521b..c97cf28 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -1597,11 +1597,8 @@ class Stream(): elif notification.notification_type == NotificationType.JOB_COMPLETE: self._state.remove_task(notification.job_action, notification.full_name) if notification.job_status == JobStatus.FAIL: - if notification.element: - unique_id = notification.full_name - else: - unique_id = None - self._state.fail_task(notification.job_action, notification.full_name, unique_id) + self._state.fail_task(notification.job_action, notification.full_name, + notification.element) else: raise StreamError("Unreccognised notification type recieved")
