Skip to content

Commit

Permalink
Catkin should send out only one notification (#358)
Browse files Browse the repository at this point in the history
* Collecting job summary into one single notification.

* Bugfix, used wrong variable for icon selection

* Added missing whitespaces

* Added yellow icon for notifications with warnings
  • Loading branch information
cbandera authored and wjwwood committed Apr 24, 2016
1 parent 916749d commit b9963df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions catkin_tools/execution/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,18 +359,21 @@ def print_exec_summary(self, completed_jobs, warned_jobs, failed_jobs):
def print_compact_summary(self, completed_jobs, warned_jobs, failed_jobs):
"""Print a compact build summary."""

notification_title = ""
notification_msg = []
# Print error summary
if len(completed_jobs) == len(self.jobs) and all(completed_jobs.items()) and len(failed_jobs) == 0:
if self.show_notifications:
notify("{} Succeded".format(self.label.capitalize()),
"{} {} completed with no warnings.".format(
len(completed_jobs), self.jobs_label))
notification_title = "{} Succeded".format(self.label.capitalize())
notification_msg.append("All {} {} succeeded!".format(len(self.jobs), self.jobs_label))

wide_log(clr('[{}] Summary: All {} {} succeeded!').format(
self.label,
len(self.jobs),
self.jobs_label))
else:
notification_msg.append("{} of {} {} succeeded.".format(
len([succeeded for jid, succeeded in completed_jobs.items() if succeeded]),
len(self.jobs), self.jobs_label))
wide_log(clr('[{}] Summary: {} of {} {} succeeded.').format(
self.label,
len([succeeded for jid, succeeded in completed_jobs.items() if succeeded]),
Expand All @@ -383,6 +386,7 @@ def print_compact_summary(self, completed_jobs, warned_jobs, failed_jobs):
wide_log(clr('[{}] Ignored: None.').format(
self.label))
else:
notification_msg.append("{} {} were skipped.".format(len(all_ignored_jobs), self.jobs_label))
wide_log(clr('[{}] Ignored: {} {} were skipped or are blacklisted.').format(
self.label,
len(all_ignored_jobs),
Expand All @@ -393,10 +397,8 @@ def print_compact_summary(self, completed_jobs, warned_jobs, failed_jobs):
wide_log(clr('[{}] Warnings: None.').format(
self.label))
else:
if self.show_notifications:
notify("{} Produced Warnings".format(self.label.capitalize()),
"{} {} succeeded with warnings.".format(
len(warned_jobs), self.jobs_label))
notification_title = "{} Succeded with Warnings".format(self.label.capitalize())
notification_msg.append("{} {} succeeded with warnings.".format(len(warned_jobs), self.jobs_label))

wide_log(clr('[{}] Warnings: {} {} succeeded with warnings.').format(
self.label,
Expand All @@ -410,10 +412,8 @@ def print_compact_summary(self, completed_jobs, warned_jobs, failed_jobs):
self.label,
self.jobs_label))
else:
if self.show_notifications:
notify("{} Incomplete".format(self.label.capitalize()),
"{} {} were abandoned.".format(
len(all_abandoned_jobs), self.jobs_label), icon_image='catkin_icon_red.png')
notification_title = "{} Incomplete".format(self.label.capitalize())
notification_msg.append("{} {} were abandoned.".format(len(all_abandoned_jobs), self.jobs_label))

wide_log(clr('[{}] Abandoned: {} {} were abandoned.').format(
self.label,
Expand All @@ -426,16 +426,22 @@ def print_compact_summary(self, completed_jobs, warned_jobs, failed_jobs):
self.label,
self.jobs_label))
else:
if self.show_notifications:
notify("{} Failed".format(self.label.capitalize()),
"{} {} failed.".format(
len(failed_jobs), self.jobs_label), icon_image='catkin_icon_red.png')
notification_title = "{} Failed".format(self.label.capitalize())
notification_msg.append("{} {} failed.".format(len(failed_jobs), self.jobs_label))

wide_log(clr('[{}] Failed: {} {} failed.').format(
self.label,
len(failed_jobs),
self.jobs_label))

if self.show_notifications:
if len(failed_jobs) != 0:
notify(notification_title, "\n".join(notification_msg), icon_image='catkin_icon_red.png')
elif len(warned_jobs) != 0:
notify(notification_title, "\n".join(notification_msg), icon_image='catkin_icon_yellow.png')
else:
notify(notification_title, "\n".join(notification_msg))

def run(self):
queued_jobs = []
active_jobs = []
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b9963df

Please # to comment.