UNPKG

@cleotasks/core

Version:

A distributed task queue system for Node.js, inspired by Celery and BullMQ

37 lines (36 loc) 1.28 kB
import { RedisInstance } from "../config/redis"; import { WorkerMetrics } from "../types/interfaces"; export declare class WorkerManager { private static instance; private redis; private taskHistoryService; private constructor(); static getInstance(instanceId?: RedisInstance): WorkerManager; getStatus(workerId: string): Promise<string>; getActiveTasks(workerId: string): Promise<string[]>; getMetrics(workerId: string): Promise<WorkerMetrics>; getLastHeartbeat(workerId: string): Promise<string>; /** * Get task history for a specific worker */ getTaskHistory(workerId: string, limit?: number): Promise<any[]>; /** * Get task history for a specific task across all workers */ getTaskHistoryById(taskId: string, limit?: number): Promise<any[]>; /** * Get global task history across all workers */ getGlobalTaskHistory(limit?: number): Promise<any[]>; /** * Get task history statistics */ getTaskHistoryStats(): Promise<{ totalTasks: number; completedTasks: number; failedTasks: number; averageDuration: number; }>; getMetricsHistory(workerId: string): Promise<WorkerMetrics[]>; getWorkerQueue(workerId: string): Promise<string>; }