Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 28, 2025

This PR implements capability-based job routing for the Effect cluster system, enabling jobs to be submitted to any runner with specific capabilities rather than being tied to specific nodes. This addresses the need to route jobs like "photo capture to any runner with camera capability" or "ML inference to any runner with GPU capability".

What's Added

New JobRunner Service: A new service that provides capability-based job submission with full type safety:

import { JobRunner } from "@effect/cluster"

const result = yield* jobRunner.submitJob({
  capabilities: ["camera"],
  job: { location: "warehouse-entrance", resolution: "1080p" },
  handler: (job) => 
    Effect.succeed({
      success: true,
      imageUrl: `https://cdn.example.com/${job.location}.jpg`,
      processedBy: "camera-runner-1"
    })
})

Key Features:

  • Type-safe job definitions with generic JobSubmissionOptions<Job, Result>
  • Multi-capability support for jobs requiring multiple capabilities (e.g., both camera and GPU)
  • Proper error handling with NoRunnersWithCapability when no suitable runners exist
  • Integration with existing infrastructure using the current shardGroups configuration

Use Cases

This enables powerful new patterns for cluster workloads:

  • IoT/Edge Computing: Route photo/video capture jobs to edge nodes with camera hardware
  • ML/AI Workloads: Route inference jobs to any available GPU-equipped runner
  • File Processing: Route storage-intensive jobs to runners with high-capacity storage
  • Specialized Hardware: Route jobs to runners with specific sensors, accelerators, or devices

Implementation Approach

The implementation follows TDD principles and leverages existing cluster infrastructure:

  1. Minimal Changes: Uses existing ShardingConfig.shardGroups instead of creating parallel systems
  2. Backward Compatible: No breaking changes to existing entity-based routing
  3. Composable: Integrates seamlessly with the Effect layer system
  4. Well-Tested: Comprehensive test suite covering success cases, error handling, and multi-capability scenarios

Configuration

Runners can be configured with capabilities using the existing shard groups:

// Camera-capable runner
const cameraRunner = ShardingConfig.layer({
  shardGroups: ["default", "camera", "image-processing"]
})

// GPU-capable runner  
const gpuRunner = ShardingConfig.layer({
  shardGroups: ["default", "gpu", "ml-inference"]
})

// Multi-capability runner
const hybridRunner = ShardingConfig.layer({
  shardGroups: ["default", "camera", "gpu", "storage"]
})

This provides a clean abstraction for capability-based routing while maintaining full compatibility with the existing cluster system.

Fixes #55.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pkg.pr.new
    • Triggering command: node /usr/local/bin/pnpm install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 28, 2025 04:55
Co-authored-by: subtleGradient <4117+subtleGradient@users.noreply.github.com>
…on and examples

Co-authored-by: subtleGradient <4117+subtleGradient@users.noreply.github.com>
Copilot AI changed the title [WIP] cluster group routing Implement capability-based job routing for cluster system Aug 28, 2025
Copilot AI requested a review from subtleGradient August 28, 2025 05:02
@subtleGradient subtleGradient moved this to Research in Native Effect Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Research

Development

Successfully merging this pull request may close these issues.

cluster group routing

2 participants