qt_rpc
Using a QObject to manage the lifetime of RPC server.
QRPCManager
Bases: QObject, QThread_interface
Manage RPC async processes within QThread context.
Source code in client/ayon_comfyui/api/qt_rpc.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
comfy_url property
Return UI url (frontend).
server_thread property
Get Server Thread for RPC.
static_server_thread property
Get Static Server Thread for RPC.
stub property
Return stored stub.
ws_pulse_client property
Get WS client to pulse backend.
__init__(*, parent=None, client_hostname='localhost', client_port=55055, server_port=55056, static_port=5454, comfy_url='http://127.0.0.1:8818', use_https=False)
Construct QRPCManager.
For a local session, the client hostname will always be hostname.
The client port is the port we use to connect to the backend, That's where this plugin acts as a "client" The server port is the port we open to the webui.
Source code in client/ayon_comfyui/api/qt_rpc.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
attach_comfyui_process(process)
Set internal process to potentially opened comfyui subprocess.
Source code in client/ayon_comfyui/api/qt_rpc.py
134 135 136 | |
get_instance() classmethod
Service Locator-like pull Singleton from class registry.
Returns:
| Type | Description |
|---|---|
QRPCManager | class contained QRPCManager instance. |
Source code in client/ayon_comfyui/api/qt_rpc.py
234 235 236 237 238 239 240 241 | |
handle_failed_heartbeat()
Handle signal received when a backend failed.
Source code in client/ayon_comfyui/api/qt_rpc.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
handle_failed_tab()
Handle signal received when a tab is closed.
Source code in client/ayon_comfyui/api/qt_rpc.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
process_scheduled_tasks()
QTimer scheduled process to run tasks stored in task queue.
Source code in client/ayon_comfyui/api/qt_rpc.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
schedule(function, *args, **kwargs)
Schedule function in qt thread.
Source code in client/ayon_comfyui/api/qt_rpc.py
108 109 110 111 112 | |
start_server()
Wraps server start logic in thread, and inject settings.
The procedure is as follows:
Firstly, a simple webserver hosting the 'static' content starts, meaning the
Secondly, the internal websocket server starts. This server is responsible for sending commands over to ComfyUI through the proxy hosted by the static server.
Next, we start a simple websocket client (no RPC), which keeps a heartbeat to the backend.
Lastly we start the internal QTimer loop. This will pop calls from the call queue and execute them, so that we can properly execute stuff in the main qt context.
Source code in client/ayon_comfyui/api/qt_rpc.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |