Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I restart ComfyUI via the API? #44

Open
vesper8 opened this issue Jul 4, 2024 · 2 comments
Open

how can I restart ComfyUI via the API? #44

vesper8 opened this issue Jul 4, 2024 · 2 comments
Assignees

Comments

@vesper8
Copy link

vesper8 commented Jul 4, 2024

I have this custom extension that I added to ComfyUI Manager


import { app } from "../../scripts/app.js";
import { api } from "../../scripts/api.js"

app.registerExtension({
	name: "Comfy.ManagerMenu.extra.restart",
    async setup() {
        const menu = document.querySelector(".comfy-menu");

        const restartButton = document.createElement("button");
        restartButton.textContent = "Restart";
        restartButton.style.color = "#d72756";
        restartButton.onclick = () => {
            api.fetchApi("/manager/reboot");
        };

        const swlocaleBtn = document.getElementById("swlocale-button");
        menu.insertBefore(restartButton, swlocaleBtn.nextSibling);
    }
});

It adds a convenient restart button so you can save a click. It also shows how easy it is to access the internal api.

I am constantly having to manually restart ComfyUI whenever a workflow fails, or sometimes when I am switching workflows, some workflows will only work after restarting ComfyUI.

I would really like to be able to perform these commands by hitting the API that you expose in this package.

Is there any possibility to do that already? If not, why not? Is there another way to restart via API?

Many thanks!

@TimPietrusky
Copy link
Member

@vesper8 thanks for bringing this up.

There is no way in the runpod-worker-comfy to restart the API yet. Does "/manager/reboot" come from the ComfyUI Manager? This is not standard ComfyUI, right?

Would you mind to share your use case? I would love to understand, why this feature would be needed in the real world. Does this happen locally when you are developing or do you also need this when the serverless API is deployed on RunPod?

@TimPietrusky TimPietrusky self-assigned this Jul 29, 2024
@vesper8
Copy link
Author

vesper8 commented Nov 26, 2024

Hi @TimPietrusky, sorry for not getting back to you sooner. However I will say that this issue continues to haunt me to this day.. I still haven't figured out how to deal with this after all these months. I also can't understand why this isn't a widely asked-for thing in general.. not just with this package I mean but in general. I can't be the only one struggling with this?

My use case is straightforward.. I provision a new Runpod and use the base image. I then SSH over the public IP and run a bunch of commands to install nodes and download models. All of this happens as part of a unattended provisioning script.

Finally I would be ready to start sending workflows via the API that this package exposes.. but there's one problem.. a ComfyUI restart/reboot is needed for all my new nodes and models to take effect.

Yet somehow.. this seems like the hardest thing to do? I still can't figure it out.. the only way I can restart ComfyUI that I know is either via the web UI or by rebooting the whole server..

What the heck am I missing here? How is this not a big problem for everyone doing things fully programatically?

I would so love a solution!!! Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants