diff --git a/README.md b/README.md index 7b928ff..3c46d71 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ # ComfyUI-WorkflowCheckpointing Automatically creates checkpoints during workflow execution. If If an workflow is canceled or ComfyUI crashes mid-execution, then these checkpoints are used when the workflow is re-queued to resume execution with minimal progress loss. + +## Configuration +By default, checkpoints are saved localy to a checkpoint folder. + +Networked checkpoints backed by the Salad Simple Storage Service can be enabled by setting the `SALAD_ORGANIZATION` environment variable. When deployed to salad, authentication is automatically pulled, but an api key can be applied when testing locally by setting `SALAD_API_KEY` + +If a request sent to `/prompt` contains a `client_id`. It is utilized to allow independent caching of executions by multiple users. + +To facilitate testing `FORCE_CRASH_AT` can be set to an integer to terminate workflow execution at a given sampling step diff --git a/workflowcheckpointing.py b/workflowcheckpointing.py index 7c57d0a..2225b6b 100644 --- a/workflowcheckpointing.py +++ b/workflowcheckpointing.py @@ -218,11 +218,11 @@ prompt_route = next(filter(lambda x: x.path == '/prompt' and x.method == 'POST' original_post_prompt = prompt_route.handler async def post_prompt_remote(request): json_data = await request.json() - if "prompt" in json_data and "extra_data" in json_data and "SALAD_ORGANIZATION" in os.environ: - extra_data = json_data["extra_data"] + if "SALAD_ORGANIZATION" in os.environ: + extra_data = json_data.get("extra_data", {}) #NOTE: Rendered obsolete by existing infrastructure, can be pruned remote_files = extra_data.get("remote_files", []) - uid = extra_data.get("uid", 'local') + uid = json_data.get("client_id", 'local') checkpoint.uid = uid await fetch_remote_files(remote_files, uid=uid) return await original_post_prompt(request)