From 85a9cf5f1bd27d9c0aa0f00977d2e8932eccd300 Mon Sep 17 00:00:00 2001 From: City <125218114+city96@users.noreply.github.com> Date: Sat, 7 Oct 2023 20:27:23 +0200 Subject: [PATCH] Random global ID --- nodes/control.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nodes/control.py b/nodes/control.py index 0c6fbb3..db8b287 100644 --- a/nodes/control.py +++ b/nodes/control.py @@ -8,6 +8,16 @@ from PIL import Image from copy import deepcopy +# set global ID once for entire session +try: GID +except NameError: + GID = ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5)) + print(f"NetDist: Set session ID to '{GID}'") +def get_client_id(): + global GID + return(f"netdist-{GID}") + + class FetchRemote(): def __init__(self): pass @@ -104,7 +114,7 @@ class QueueRemoteChainStart: "prompt": prompt, "current_seed": seed+batch, "current_batch": batch, - "job_id": f"netdist-{time.time()}" + "job_id": f"{get_client_id()}-{int(time.time()*1000*1000)}" } return(remote_chain,) @@ -246,7 +256,7 @@ class QueueRemote: data = { "prompt": prompt, - "client_id": "netdist", + "client_id": get_client_id(), "extra_data": { "job_id": remote_info["job_id"], }