batch-cluster
    Preparing search index...

    Class Task<T>

    Tasks embody individual jobs given to the underlying child processes. Each instance has a promise that will be resolved or rejected based on the result of the task.

    Type Parameters

    • T = unknown
    Index
    • Type Parameters

      • T = unknown

      Parameters

      • command: string

        is the value written to stdin to perform the given task.

      • parser: Parser<T>

        is used to parse resulting data from the underlying process to a typed object.

      Returns Task<T>

    command: string

    is the value written to stdin to perform the given task.

    parser: Parser<T>

    is used to parse resulting data from the underlying process to a typed object.

    taskId: number = ...
    • get promise(): Promise<T>

      Returns Promise<T>

      the resolution or rejection of this task.

    • get runtimeMs(): number | undefined

      Returns number | undefined

    • get timeoutElapsedMs(): number | undefined

      Time since this task started, or since its last timeout reset.

      Returns number | undefined

    • Called by BatchProcess when this task starts. Overrides must pass every argument to super.onStart(), or Task.resetTimeout stops working.

      Parameters

      • opts: TaskOptions
      • OptionalbeforeParse: () => void
      • OptionalresetTimeout: () => boolean

      Returns void

    • Called with this task's stderr. Non-blank stderr is logged at warn, so a subclass that removes lines it understands before calling super.onStderr() keeps those lines out of the log.

      Parameters

      • buf: string | Buffer<ArrayBufferLike>

      Returns void

    • Parameters

      • buf: string | Buffer<ArrayBufferLike>

      Returns void

    • Parameters

      • error: Error

      Returns boolean

      true if the wrapped promise was rejected

    • Restart this task's timeout. Call this only after verifying that the task made progress: output alone is not progress.

      Returns boolean

      false if the task isn't running or has no timeout, and for startup and health-check tasks.