Hierarchy (View Summary)

  • DataEntity<
        {
            error?: ErrorData;
            estimatedStartAt?: Date;
            eta?: Date;
            id: string;
            params: ProjectParams;
            queuePosition: number;
            queueStatus?: "waiting"
            | "no-workers";
            startedAt: Date;
            status: ProjectStatus;
        },
        ProjectEventMap,
    >
    • Project

Constructors

Properties

data: {
    error?: ErrorData;
    estimatedStartAt?: Date;
    eta?: Date;
    id: string;
    params: ProjectParams;
    queuePosition: number;
    queueStatus?: "waiting" | "no-workers";
    startedAt: Date;
    status: ProjectStatus;
}

Type declaration

  • Optionalerror?: ErrorData
  • OptionalestimatedStartAt?: Date

    Estimated time at which a worker will start this project, while it is still queued. Cleared once the project starts processing. undefined when the server cannot estimate — see ProjectData.queueStatus.

  • Optionaleta?: Date

    Estimated completion time of the project (for long-running projects like video generation). Is equal to maximum job ETA

  • id: string
  • params: ProjectParams
  • queuePosition: number
  • OptionalqueueStatus?: "waiting" | "no-workers"

    'no-workers' when nothing currently connected can run this project's model.

  • startedAt: Date
  • status: ProjectStatus
lastUpdated: Date = ...
listeners: {
    completed?: (data: string[]) => void[];
    failed?: (data: ErrorData) => void[];
    jobCompleted?: (data: Job) => void[];
    jobFailed?: (data: Job) => void[];
    jobStarted?: (data: Job) => void[];
    progress?: (data: number) => void[];
    updated?: (data: string[]) => void[];
} = {}

Accessors

  • get estimatedStartAt(): undefined | Date

    Time at which a worker is expected to start this project, while it is still queued. Undefined once processing starts, or when the server cannot estimate a wait.

    Prefer this over Project.queuePosition when telling a user how long they have to wait: position counts projects, not time, so being first in line behind a long video render is still a long wait.

    Returns undefined | Date

  • get eta(): undefined | Date

    Estimated time of completion in seconds (for long-running projects like video generation). Updated by ComfyUI workers during inference.

    Returns undefined | Date

  • get jobs(): Job[]

    List of jobs in the project. Note that jobs will be added to this list as workers start processing them. So initially this list will be empty. Subscribe to project updated event to get notified about any update, including new jobs.

    Returns Job[]

    project.on('updated', (keys) => {
    if (keys.includes('jobs')) {
    // Project jobs have been updated
    }
    });
  • get progress(): number

    Progress of the project in percentage (0-100).

    Returns number

  • get queueStatus(): undefined | "waiting" | "no-workers"

    'no-workers' when nothing currently connected can run this project's model, in which case Project.estimatedStartAt is undefined and the project is waiting for a worker to come online rather than for the queue to drain.

    Returns undefined | "waiting" | "no-workers"

  • get resultUrls(): string[]

    List of result URLs for all completed jobs in the project.

    Returns string[]

Methods

  • Cancel the project. This will cancel all jobs in the project.

    Returns Promise<void>

  • Get full project data snapshot. Can be used to serialize the project and store it in a database.

    Returns {
        error?: ErrorData;
        estimatedStartAt?: Date;
        eta?: Date;
        id: string;
        jobs: {
            error?: ErrorData;
            eta?: Date;
            etaRange?: { max: number; min: number };
            etaSeconds?: number;
            etaStartedAt?: Date;
            externalProgress?: number;
            id: string;
            isNSFW?: boolean;
            jobIndex?: number;
            negativePrompt?: string;
            positivePrompt?: string;
            previewUrl?: string;
            projectId: string;
            resultUrl?: null | string;
            seed?: number;
            status: JobStatus;
            step: number;
            stepCount: number;
            userCanceled?: boolean;
            workerName?: string;
        }[];
        params: ProjectParams;
        queuePosition: number;
        queueStatus?: "waiting"
        | "no-workers";
        startedAt: Date;
        status: ProjectStatus;
    }

    • Optionalerror?: ErrorData
    • OptionalestimatedStartAt?: Date

      Estimated time at which a worker will start this project, while it is still queued. Cleared once the project starts processing. undefined when the server cannot estimate — see ProjectData.queueStatus.

    • Optionaleta?: Date

      Estimated completion time of the project (for long-running projects like video generation). Is equal to maximum job ETA

    • id: string
    • jobs: {
          error?: ErrorData;
          eta?: Date;
          etaRange?: { max: number; min: number };
          etaSeconds?: number;
          etaStartedAt?: Date;
          externalProgress?: number;
          id: string;
          isNSFW?: boolean;
          jobIndex?: number;
          negativePrompt?: string;
          positivePrompt?: string;
          previewUrl?: string;
          projectId: string;
          resultUrl?: null | string;
          seed?: number;
          status: JobStatus;
          step: number;
          stepCount: number;
          userCanceled?: boolean;
          workerName?: string;
      }[]
    • params: ProjectParams
    • queuePosition: number
    • OptionalqueueStatus?: "waiting" | "no-workers"

      'no-workers' when nothing currently connected can run this project's model.

    • startedAt: Date
    • status: ProjectStatus
  • Wait for the project to complete, then return the result URLs, or throw an error if the project fails.

    Returns Promise<string[]>

    Promise<string[]> - Promise that resolves to the list of result URLs

    ErrorData