Task Methods

MethodParametersDescription
createTaskname: string
config: TaskConfig
Creates a new task
scheduleTasktaskId: string
schedule: string
Schedules an existing task

Types

interface TaskConfig {
  // Task configuration options
  retries?: number;
  timeout?: number;
  schedule?: string;
}

interface Task {
  id: string;
  status: 'pending' | 'running' | 'completed';
  // ... other properties
}

Steps

1

createTask
2

Creates a new task with the specified configuration
3

Parameters:
4

  • name: string - Name of the task
  • config: TaskConfig - Task configuration
  • 5

    Returns: Task
    6

    scheduleTask
    7

    Schedules a task for execution
    8

    Parameters:
    9

  • taskId: string - ID of the task to schedule
  • schedule: string - Cron expression or date