CompositeProvider Class
A composite runner provider that implements fallback and distribution strategies.
Initializer
import { CompositeProvider } from '@cloudsnorkel/cdk-github-runners'
new CompositeProvider()import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.CompositeProvider()import com.cloudsnorkel.cdk.github.runners.CompositeProvider;
new CompositeProvider();using CloudSnorkel;
new CompositeProvider();import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.NewCompositeProvider() CompositeProviderStatic Functions
distribute()distribute()distribute()Distribute()Distribute()
Creates a weighted distribution runner provider that randomly selects a provider based on weights.
For example, given providers A (weight 10), B (weight 20), C (weight 30):
- Total weight = 60
- Probability of selecting A = 10/60 = 16.67%
- Probability of selecting B = 20/60 = 33.33%
- Probability of selecting C = 30/60 = 50%
You can use this to distribute load across multiple instance types or availability zones.
import { CompositeProvider } from '@cloudsnorkel/cdk-github-runners'
CompositeProvider.distribute(scope: Construct, id: string, weightedProviders: WeightedRunnerProvider[])scope:ConstructThe scope in which to define this construct.
id:stringThe scoped construct ID.
weightedProviders:WeightedRunnerProvider[]List of weighted runner providers.
import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.CompositeProvider.distribute(
scope: Construct,
id: str,
weighted_providers: typing.List[WeightedRunnerProvider]
)scope:ConstructThe scope in which to define this construct.
id:strThe scoped construct ID.
weighted_providers:typing.List[WeightedRunnerProvider]List of weighted runner providers.
import com.cloudsnorkel.cdk.github.runners.CompositeProvider;
CompositeProvider.distribute(Construct scope, java.lang.String id, java.util.List<WeightedRunnerProvider> weightedProviders)scope:ConstructThe scope in which to define this construct.
id:java.lang.StringThe scoped construct ID.
weightedProviders:java.util.List<WeightedRunnerProvider>List of weighted runner providers.
using CloudSnorkel;
CompositeProvider.Distribute(Construct Scope, string Id, WeightedRunnerProvider[] WeightedProviders);Scope:ConstructThe scope in which to define this construct.
Id:stringThe scoped construct ID.
WeightedProviders:WeightedRunnerProvider[]List of weighted runner providers.
import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.CompositeProvider_Distribute(scope Construct, id *string, weightedProviders *[]WeightedRunnerProvider) ICompositeProviderscope:ConstructThe scope in which to define this construct.
id:*stringThe scoped construct ID.
weightedProviders:*[]WeightedRunnerProviderList of weighted runner providers.
fallback()fallback()fallback()Fallback()Fallback()
Creates a fallback runner provider that tries each provider in order until one succeeds.
For example, given providers A, B, C:
- Try A first
- If A fails, try B
- If B fails, try C
You can use this to try spot instance first, and switch to on-demand instances if spot is unavailable.
Or you can use this to try different instance types in order of preference.
import { CompositeProvider } from '@cloudsnorkel/cdk-github-runners'
CompositeProvider.fallback(scope: Construct, id: string, providers: IRunnerProvider[])scope:ConstructThe scope in which to define this construct.
id:stringThe scoped construct ID.
providers:IRunnerProvider[]List of runner providers to try in order.
import cloudsnorkel.cdk_github_runners
cloudsnorkel.cdk_github_runners.CompositeProvider.fallback(
scope: Construct,
id: str,
providers: typing.List[IRunnerProvider]
)scope:ConstructThe scope in which to define this construct.
id:strThe scoped construct ID.
providers:typing.List[IRunnerProvider]List of runner providers to try in order.
import com.cloudsnorkel.cdk.github.runners.CompositeProvider;
CompositeProvider.fallback(Construct scope, java.lang.String id, java.util.List<IRunnerProvider> providers)scope:ConstructThe scope in which to define this construct.
id:java.lang.StringThe scoped construct ID.
providers:java.util.List<IRunnerProvider>List of runner providers to try in order.
using CloudSnorkel;
CompositeProvider.Fallback(Construct Scope, string Id, IRunnerProvider[] Providers);Scope:ConstructThe scope in which to define this construct.
Id:stringThe scoped construct ID.
Providers:IRunnerProvider[]List of runner providers to try in order.
import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"
cloudsnorkelcdkgithubrunners.CompositeProvider_Fallback(scope Construct, id *string, providers *[]IRunnerProvider) ICompositeProviderscope:ConstructThe scope in which to define this construct.
id:*stringThe scoped construct ID.
providers:*[]IRunnerProviderList of runner providers to try in order.