mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Add simple notifications on job errors, completion and start. (#46)
This commit is contained in:
@@ -13,3 +13,5 @@ zeroconf==0.119.0
|
|||||||
Pypubsub~=4.0.3
|
Pypubsub~=4.0.3
|
||||||
tqdm==4.66.1
|
tqdm==4.66.1
|
||||||
dmglib==0.9.4
|
dmglib==0.9.4
|
||||||
|
plyer==2.1.0
|
||||||
|
pyobjus==1.2.3
|
||||||
@@ -4,10 +4,11 @@ import socket
|
|||||||
import time
|
import time
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
from plyer import notification
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
|
|
||||||
from src.render_queue import RenderQueue
|
|
||||||
from src.api.server_proxy import RenderServerProxy
|
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.misc_helper import get_file_size_human
|
||||||
from src.utilities.status_utils import RenderStatus, string_to_status
|
from src.utilities.status_utils import RenderStatus, string_to_status
|
||||||
from src.utilities.zeroconf_server import ZeroconfServer
|
from src.utilities.zeroconf_server import ZeroconfServer
|
||||||
@@ -55,6 +56,29 @@ class DistributedJobManager:
|
|||||||
# todo: handle cancelling all the children
|
# todo: handle cancelling all the children
|
||||||
pass
|
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
|
@classmethod
|
||||||
def handle_subjob_status_change(cls, local_job, subjob_data):
|
def handle_subjob_status_change(cls, local_job, subjob_data):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ class RenderQueue:
|
|||||||
def start_queue(cls):
|
def start_queue(cls):
|
||||||
cls.load_state()
|
cls.load_state()
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def job_status_change(cls, job_id, status):
|
|
||||||
logger.debug(f"Job status changed: {job_id} -> {status}")
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_to_render_queue(cls, render_job, force_start=False):
|
def add_to_render_queue(cls, render_job, force_start=False):
|
||||||
logger.debug('Adding priority {} job to render queue: {}'.format(render_job.priority, render_job))
|
logger.debug('Adding priority {} job to render queue: {}'.format(render_job.priority, render_job))
|
||||||
|
|||||||
Reference in New Issue
Block a user