[cleanup] Remove dead code do_update_all function

- Removed do_update_all function that was never called and only returned an error
- Removed "update-all" from OperationType enum as it's no longer used
- Regenerated data models to reflect the enum change

The update_all functionality now properly creates individual update tasks through the API endpoint rather than being a single monolithic task.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
bymyself 2025-06-17 13:27:51 -07:00
parent 14298b0859
commit d081db0c30
3 changed files with 74 additions and 33 deletions

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen: # generated by datamodel-codegen:
# filename: openapi.yaml # filename: openapi.yaml
# timestamp: 2025-06-17T19:50:44+00:00 # timestamp: 2025-06-17T20:27:16+00:00
from __future__ import annotations from __future__ import annotations
@ -8,14 +8,17 @@ from datetime import datetime
from enum import Enum from enum import Enum
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
from pydantic import BaseModel, Field, RootModel, conint from pydantic import BaseModel, Field
class OperationType(Enum): class OperationType(Enum):
"""
Type of operation or task being performed
"""
install = 'install' install = 'install'
uninstall = 'uninstall' uninstall = 'uninstall'
update = 'update' update = 'update'
update_all = 'update-all'
update_comfyui = 'update-comfyui' update_comfyui = 'update-comfyui'
fix = 'fix' fix = 'fix'
disable = 'disable' disable = 'disable'
@ -24,6 +27,10 @@ class OperationType(Enum):
class OperationResult(Enum): class OperationResult(Enum):
"""
Result status of an operation (failed/error and skipped/skip are aliases)
"""
success = 'success' success = 'success'
failed = 'failed' failed = 'failed'
skipped = 'skipped' skipped = 'skipped'
@ -38,6 +45,10 @@ class TaskExecutionStatus(BaseModel):
class ManagerMessageName(Enum): class ManagerMessageName(Enum):
"""
WebSocket message type constants for manager events
"""
cm_task_completed = 'cm-task-completed' cm_task_completed = 'cm-task-completed'
cm_task_started = 'cm-task-started' cm_task_started = 'cm-task-started'
cm_queue_status = 'cm-queue-status' cm_queue_status = 'cm-queue-status'
@ -68,11 +79,19 @@ class ManagerPackInstalled(BaseModel):
class SelectedVersion(Enum): class SelectedVersion(Enum):
"""
Version selection for pack installation
"""
latest = 'latest' latest = 'latest'
nightly = 'nightly' nightly = 'nightly'
class ManagerChannel(Enum): class ManagerChannel(Enum):
"""
Channel for pack sources
"""
default = 'default' default = 'default'
recent = 'recent' recent = 'recent'
legacy = 'legacy' legacy = 'legacy'
@ -82,12 +101,20 @@ class ManagerChannel(Enum):
class ManagerDatabaseSource(Enum): class ManagerDatabaseSource(Enum):
"""
Source for pack information
"""
remote = 'remote' remote = 'remote'
local = 'local' local = 'local'
cache = 'cache' cache = 'cache'
class ManagerPackState(Enum): class ManagerPackState(Enum):
"""
Current state of a pack
"""
installed = 'installed' installed = 'installed'
disabled = 'disabled' disabled = 'disabled'
not_installed = 'not_installed' not_installed = 'not_installed'
@ -96,12 +123,20 @@ class ManagerPackState(Enum):
class ManagerPackInstallType(Enum): class ManagerPackInstallType(Enum):
"""
Type of installation used for the pack
"""
git_clone = 'git-clone' git_clone = 'git-clone'
copy = 'copy' copy = 'copy'
cnr = 'cnr' cnr = 'cnr'
class SecurityLevel(Enum): class SecurityLevel(Enum):
"""
Security level configuration (from most to least restrictive)
"""
strong = 'strong' strong = 'strong'
normal = 'normal' normal = 'normal'
normal_ = 'normal-' normal_ = 'normal-'
@ -109,12 +144,20 @@ class SecurityLevel(Enum):
class RiskLevel(Enum): class RiskLevel(Enum):
"""
Risk classification for operations
"""
block = 'block' block = 'block'
high = 'high' high = 'high'
middle = 'middle' middle = 'middle'
class UpdateState(Enum): class UpdateState(Enum):
"""
Update availability status
"""
false = 'false' false = 'false'
true = 'true' true = 'true'
@ -228,10 +271,8 @@ class ManagerMappings1(BaseModel):
title_aux: Optional[str] = Field(None, description='The display name of the pack') title_aux: Optional[str] = Field(None, description='The display name of the pack')
class ManagerMappings( class ManagerMappings(BaseModel):
RootModel[Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]]] __root__: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field(
):
root: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field(
None, description='Tuple of [node_names, metadata]' None, description='Tuple of [node_names, metadata]'
) )
@ -247,6 +288,10 @@ class ModelMetadata(BaseModel):
class InstallType(Enum): class InstallType(Enum):
"""
Installation method
"""
git = 'git' git = 'git'
copy = 'copy' copy = 'copy'
pip = 'pip' pip = 'pip'
@ -269,16 +314,20 @@ class NodePackageMetadata(BaseModel):
mode: Optional[str] = Field(None, description='Source mode') mode: Optional[str] = Field(None, description='Source mode')
class SnapshotItem(RootModel[str]): class SnapshotItem(BaseModel):
root: str = Field(..., description='Name of the snapshot') __root__: str = Field(..., description='Name of the snapshot')
class Error(BaseModel): class Error(BaseModel):
error: str = Field(..., description='Error message') error: str = Field(..., description='Error message')
class InstalledPacksResponse(RootModel[Optional[Dict[str, ManagerPackInstalled]]]): class InstalledPacksResponse(BaseModel):
root: Optional[Dict[str, ManagerPackInstalled]] = None """
Map of pack names to their installation info
"""
__root__: Optional[Dict[str, ManagerPackInstalled]] = None
class HistoryListResponse(BaseModel): class HistoryListResponse(BaseModel):
@ -306,7 +355,7 @@ class InstalledModelInfo(BaseModel):
name: str = Field(..., description='Model filename') name: str = Field(..., description='Model filename')
path: str = Field(..., description='Full path to model file') path: str = Field(..., description='Full path to model file')
type: str = Field(..., description='Model type (checkpoint, lora, vae, etc.)') type: str = Field(..., description='Model type (checkpoint, lora, vae, etc.)')
size_bytes: Optional[conint(ge=0)] = Field(None, description='File size in bytes') size_bytes: Optional[int] = Field(None, description='File size in bytes', ge=0)
hash: Optional[str] = Field(None, description='Model file hash for verification') hash: Optional[str] = Field(None, description='Model file hash for verification')
install_date: Optional[datetime] = Field( install_date: Optional[datetime] = Field(
None, description='ISO timestamp when added' None, description='ISO timestamp when added'
@ -384,8 +433,8 @@ class ComfyUISystemState(BaseModel):
cli_args: Optional[Dict[str, Any]] = Field( cli_args: Optional[Dict[str, Any]] = Field(
None, description='Selected ComfyUI CLI arguments' None, description='Selected ComfyUI CLI arguments'
) )
custom_nodes_count: Optional[conint(ge=0)] = Field( custom_nodes_count: Optional[int] = Field(
None, description='Total number of custom node packages' None, description='Total number of custom node packages', ge=0
) )
failed_imports: Optional[List[str]] = Field( failed_imports: Optional[List[str]] = Field(
None, description='List of custom nodes that failed to import' None, description='List of custom nodes that failed to import'
@ -408,17 +457,17 @@ class BatchExecutionRecord(BaseModel):
operations: Optional[List[BatchOperation]] = Field( operations: Optional[List[BatchOperation]] = Field(
None, description='List of operations performed in this batch' None, description='List of operations performed in this batch'
) )
total_operations: Optional[conint(ge=0)] = Field( total_operations: Optional[int] = Field(
0, description='Total number of operations in batch' 0, description='Total number of operations in batch', ge=0
) )
successful_operations: Optional[conint(ge=0)] = Field( successful_operations: Optional[int] = Field(
0, description='Number of successful operations' 0, description='Number of successful operations', ge=0
) )
failed_operations: Optional[conint(ge=0)] = Field( failed_operations: Optional[int] = Field(
0, description='Number of failed operations' 0, description='Number of failed operations', ge=0
) )
skipped_operations: Optional[conint(ge=0)] = Field( skipped_operations: Optional[int] = Field(
0, description='Number of skipped operations' 0, description='Number of skipped operations', ge=0
) )
@ -487,10 +536,8 @@ class MessageTaskFailed(BaseModel):
state: TaskStateMessage state: TaskStateMessage
class MessageUpdate( class MessageUpdate(BaseModel):
RootModel[Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed]] __root__: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field(
):
root: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field(
..., description='Union type for all possible WebSocket message updates' ..., description='Union type for all possible WebSocket message updates'
) )

View File

@ -992,12 +992,6 @@ async def task_worker():
return f"Model installation error: {model_url}" return f"Model installation error: {model_url}"
async def do_update_all(params: UpdateAllPacksParams):
# For update-all tasks, we need client info from the original task
# This should not be called anymore since update_all now creates individual tasks
return "error: update_all should create individual tasks, not use task worker"
while True: while True:
timeout = 4096 timeout = 4096
task = task_queue.get(timeout) task = task_queue.get(timeout)

View File

@ -20,7 +20,7 @@ components:
schemas: schemas:
OperationType: OperationType:
type: string type: string
enum: [install, uninstall, update, update-all, update-comfyui, fix, disable, enable, install-model] enum: [install, uninstall, update, update-comfyui, fix, disable, enable, install-model]
description: Type of operation or task being performed description: Type of operation or task being performed
OperationResult: OperationResult:
type: string type: string