Print device name on task start and complete to avoid doubt from users on what device selected the task.

This commit is contained in:
Marc-Andre Ferland 2022-11-01 22:28:10 -04:00
parent eb596ba866
commit b09b80933d

View File

@ -290,7 +290,7 @@ def thread_render(device):
task.response = {"status": 'failed', "detail": str(task.error)} task.response = {"status": 'failed', "detail": str(task.error)}
task.buffer_queue.put(json.dumps(task.response)) task.buffer_queue.put(json.dumps(task.response))
continue continue
print(f'Session {task.request.session_id} starting task {id(task)}') print(f'Session {task.request.session_id} starting task {id(task)} on {runtime.thread_data.device_name}')
if not task.lock.acquire(blocking=False): raise Exception('Got locked task from queue.') if not task.lock.acquire(blocking=False): raise Exception('Got locked task from queue.')
try: try:
if runtime.thread_data.device == 'cpu' and is_alive() > 1: if runtime.thread_data.device == 'cpu' and is_alive() > 1:
@ -344,7 +344,7 @@ def thread_render(device):
elif task.error is not None: elif task.error is not None:
print(f'Session {task.request.session_id} task {id(task)} failed!') print(f'Session {task.request.session_id} task {id(task)} failed!')
else: else:
print(f'Session {task.request.session_id} task {id(task)} completed.') print(f'Session {task.request.session_id} task {id(task)} completed by {runtime.thread_data.device_name}.')
current_state = ServerStates.Online current_state = ServerStates.Online
def get_cached_task(session_id:str, update_ttl:bool=False): def get_cached_task(session_id:str, update_ttl:bool=False):