Add simple notifications on job errors, completion and start. (#46)

This commit is contained in:
2023-10-25 06:15:52 -05:00
committed by GitHub
parent 917a15c60c
commit cc1cf92118
3 changed files with 28 additions and 6 deletions

View File

@@ -4,10 +4,11 @@ import socket
import time
import zipfile
from plyer import notification
from pubsub import pub
from src.render_queue import RenderQueue
from src.api.server_proxy import RenderServerProxy
from src.render_queue import RenderQueue
from src.utilities.misc_helper import get_file_size_human
from src.utilities.status_utils import RenderStatus, string_to_status
from src.utilities.zeroconf_server import ZeroconfServer
@@ -55,6 +56,29 @@ class DistributedJobManager:
# todo: handle cancelling all the children
pass
# UI Notifications
if new_status == RenderStatus.COMPLETED:
logger.debug("show render complete notification")
notification.notify(
title='Render Job Complete',
message=f'Render completed for {render_job.name}',
timeout=10 # Display time in seconds
)
elif new_status == RenderStatus.ERROR:
logger.debug("show render complete notification")
notification.notify(
title='Render Job Failed',
message=f'Failed rendering {render_job.name}',
timeout=10 # Display time in seconds
)
elif new_status == RenderStatus.RUNNING:
logger.debug("show render complete notification")
notification.notify(
title='Render Job Started',
message=f'Render started for {render_job.name}',
timeout=10 # Display time in seconds
)
@classmethod
def handle_subjob_status_change(cls, local_job, subjob_data):
"""