expose job_timeout in settings tab

pull/15/head
unknown 2023-06-13 11:50:40 -05:00
parent 10d0ff6482
commit bac528d4cb
No known key found for this signature in database
GPG Key ID: CA376082283AF69A
2 changed files with 12 additions and 4 deletions

View File

@ -63,9 +63,12 @@ class UI:
return 'No active jobs!', worker_status
def save_btn(self, thin_client_mode):
def save_btn(self, thin_client_mode, job_timeout):
self.world.thin_client_mode = thin_client_mode
logger.debug(f"thin client mode is now {thin_client_mode}")
job_timeout = int(job_timeout)
self.world.job_timeout = job_timeout
logger.debug(f"job timeout is now {job_timeout} seconds")
# end handlers
@ -107,8 +110,13 @@ class UI:
info="Only generate images using remote workers. There will be no previews when enabled.",
value=self.world.thin_client_mode
)
job_timeout = gradio.Number(
label='Job timeout', value=self.world.job_timeout,
info="Seconds until a worker is considered too slow to be assigned an"
"equal share of the total request. Longer than 2 seconds is recommended."
)
save_btn = gradio.Button(value='Save')
save_btn.click(fn=self.save_btn, inputs=[thin_client_cbx])
save_btn.click(fn=self.save_btn, inputs=[thin_client_cbx, job_timeout])
return root

View File

@ -368,8 +368,8 @@ class Worker:
self.response_time = time.time() - start
variance = ((eta - self.response_time) / self.response_time) * 100
logger.debug(f"\nWorker '{self.uuid}'s ETA was off by {variance:.2f}%.\n")
logger.debug(f"Predicted {eta:.2f}s. Actual: {self.response_time:.2f}s\n")
logger.debug(f"\nWorker '{self.uuid}'s ETA was off by {variance:.2f}%.\n"
f"Predicted {eta:.2f}s. Actual: {self.response_time:.2f}s\n")
# if the variance is greater than 500% then we ignore it to prevent variation inflation
if abs(variance) < 500: