MCPcopy Create free account
hub / github.com/SipherAGI/sd-webui-agent-scheduler / f

Method f

scripts/task_scheduler.py:196–234  ·  view source on GitHub ↗
(request: gr.Request, *args)

Source from the content-addressed store, hash-verified

194
195 def wrap_register_ui_task(self):
196 def f(request: gr.Request, *args):
197 if len(args) == 0:
198 raise Exception("Invalid call")
199
200 checkpoint: str = args[0]
201 task_id = args[1]
202 args = args[1:]
203 task_name = None
204
205 if task_id == queue_with_every_checkpoints:
206 task_id = str(uuid4())
207 checkpoint = list_checkpoint_tiles()
208 else:
209 if not task_id.startswith("task("):
210 task_name = task_id
211 task_id = str(uuid4())
212
213 if checkpoint is None or checkpoint == "" or checkpoint == checkpoint_current:
214 checkpoint = [shared.sd_model.sd_checkpoint_info.title]
215 elif checkpoint == checkpoint_runtime:
216 checkpoint = [None]
217 elif checkpoint.endswith(" checkpoints)"):
218 checkpoint_dir = " ".join(checkpoint.split(" ")[0:-2])
219 checkpoint = list(filter(lambda c: c.startswith(checkpoint_dir), list_checkpoint_tiles()))
220 else:
221 checkpoint = [checkpoint]
222
223 for i, c in enumerate(checkpoint):
224 t_id = task_id if i == 0 else f"{task_id}.{i}"
225 task_runner.register_ui_task(
226 t_id,
227 self.is_img2img,
228 *args,
229 checkpoint=c,
230 task_name=task_name,
231 request=request,
232 )
233
234 task_runner.execute_pending_tasks_threading()
235
236 return f
237

Callers

nothing calls this directly

Calls 2

register_ui_taskMethod · 0.80

Tested by

no test coverage detected