1. Packages
  2. Nomad Provider
  3. API Docs
  4. SchedulerConfig
Nomad v2.4.1 published on Wednesday, Oct 30, 2024 by Pulumi

nomad.SchedulerConfig

Explore with Pulumi AI

nomad logo
Nomad v2.4.1 published on Wednesday, Oct 30, 2024 by Pulumi

    Manages scheduler configuration of the Nomad cluster.

    Warning: destroying this resource will not have any effect in the cluster configuration, since there’s no clear definition of what a destroy action should do. The cluster will be left as-is and only the state reference will be removed.

    Example Usage

    Set cluster scheduler configuration:

    import * as pulumi from "@pulumi/pulumi";
    import * as nomad from "@pulumi/nomad";
    
    const config = new nomad.SchedulerConfig("config", {
        schedulerAlgorithm: "spread",
        memoryOversubscriptionEnabled: true,
        preemptionConfig: {
            system_scheduler_enabled: true,
            batch_scheduler_enabled: true,
            service_scheduler_enabled: true,
            sysbatch_scheduler_enabled: true,
        },
    });
    
    import pulumi
    import pulumi_nomad as nomad
    
    config = nomad.SchedulerConfig("config",
        scheduler_algorithm="spread",
        memory_oversubscription_enabled=True,
        preemption_config={
            "system_scheduler_enabled": True,
            "batch_scheduler_enabled": True,
            "service_scheduler_enabled": True,
            "sysbatch_scheduler_enabled": True,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := nomad.NewSchedulerConfig(ctx, "config", &nomad.SchedulerConfigArgs{
    			SchedulerAlgorithm:            pulumi.String("spread"),
    			MemoryOversubscriptionEnabled: pulumi.Bool(true),
    			PreemptionConfig: pulumi.BoolMap{
    				"system_scheduler_enabled":   pulumi.Bool(true),
    				"batch_scheduler_enabled":    pulumi.Bool(true),
    				"service_scheduler_enabled":  pulumi.Bool(true),
    				"sysbatch_scheduler_enabled": pulumi.Bool(true),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nomad = Pulumi.Nomad;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Nomad.SchedulerConfig("config", new()
        {
            SchedulerAlgorithm = "spread",
            MemoryOversubscriptionEnabled = true,
            PreemptionConfig = 
            {
                { "system_scheduler_enabled", true },
                { "batch_scheduler_enabled", true },
                { "service_scheduler_enabled", true },
                { "sysbatch_scheduler_enabled", true },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nomad.SchedulerConfig;
    import com.pulumi.nomad.SchedulerConfigArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var config = new SchedulerConfig("config", SchedulerConfigArgs.builder()
                .schedulerAlgorithm("spread")
                .memoryOversubscriptionEnabled(true)
                .preemptionConfig(Map.ofEntries(
                    Map.entry("system_scheduler_enabled", true),
                    Map.entry("batch_scheduler_enabled", true),
                    Map.entry("service_scheduler_enabled", true),
                    Map.entry("sysbatch_scheduler_enabled", true)
                ))
                .build());
    
        }
    }
    
    resources:
      config:
        type: nomad:SchedulerConfig
        properties:
          schedulerAlgorithm: spread
          memoryOversubscriptionEnabled: true
          preemptionConfig:
            system_scheduler_enabled: true
            batch_scheduler_enabled: true
            service_scheduler_enabled: true
            sysbatch_scheduler_enabled: true
    

    Create SchedulerConfig Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SchedulerConfig(name: string, args?: SchedulerConfigArgs, opts?: CustomResourceOptions);
    @overload
    def SchedulerConfig(resource_name: str,
                        args: Optional[SchedulerConfigArgs] = None,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def SchedulerConfig(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        memory_oversubscription_enabled: Optional[bool] = None,
                        preemption_config: Optional[Mapping[str, bool]] = None,
                        scheduler_algorithm: Optional[str] = None)
    func NewSchedulerConfig(ctx *Context, name string, args *SchedulerConfigArgs, opts ...ResourceOption) (*SchedulerConfig, error)
    public SchedulerConfig(string name, SchedulerConfigArgs? args = null, CustomResourceOptions? opts = null)
    public SchedulerConfig(String name, SchedulerConfigArgs args)
    public SchedulerConfig(String name, SchedulerConfigArgs args, CustomResourceOptions options)
    
    type: nomad:SchedulerConfig
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SchedulerConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SchedulerConfigArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SchedulerConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SchedulerConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SchedulerConfigArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var schedulerConfigResource = new Nomad.SchedulerConfig("schedulerConfigResource", new()
    {
        MemoryOversubscriptionEnabled = false,
        PreemptionConfig = 
        {
            { "string", false },
        },
        SchedulerAlgorithm = "string",
    });
    
    example, err := nomad.NewSchedulerConfig(ctx, "schedulerConfigResource", &nomad.SchedulerConfigArgs{
    	MemoryOversubscriptionEnabled: pulumi.Bool(false),
    	PreemptionConfig: pulumi.BoolMap{
    		"string": pulumi.Bool(false),
    	},
    	SchedulerAlgorithm: pulumi.String("string"),
    })
    
    var schedulerConfigResource = new SchedulerConfig("schedulerConfigResource", SchedulerConfigArgs.builder()
        .memoryOversubscriptionEnabled(false)
        .preemptionConfig(Map.of("string", false))
        .schedulerAlgorithm("string")
        .build());
    
    scheduler_config_resource = nomad.SchedulerConfig("schedulerConfigResource",
        memory_oversubscription_enabled=False,
        preemption_config={
            "string": False,
        },
        scheduler_algorithm="string")
    
    const schedulerConfigResource = new nomad.SchedulerConfig("schedulerConfigResource", {
        memoryOversubscriptionEnabled: false,
        preemptionConfig: {
            string: false,
        },
        schedulerAlgorithm: "string",
    });
    
    type: nomad:SchedulerConfig
    properties:
        memoryOversubscriptionEnabled: false
        preemptionConfig:
            string: false
        schedulerAlgorithm: string
    

    SchedulerConfig Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The SchedulerConfig resource accepts the following input properties:

    MemoryOversubscriptionEnabled bool
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    PreemptionConfig Dictionary<string, bool>
    (map[string]bool) - Options to enable preemption for various schedulers.
    SchedulerAlgorithm string
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    MemoryOversubscriptionEnabled bool
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    PreemptionConfig map[string]bool
    (map[string]bool) - Options to enable preemption for various schedulers.
    SchedulerAlgorithm string
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memoryOversubscriptionEnabled Boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig Map<String,Boolean>
    (map[string]bool) - Options to enable preemption for various schedulers.
    schedulerAlgorithm String
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memoryOversubscriptionEnabled boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig {[key: string]: boolean}
    (map[string]bool) - Options to enable preemption for various schedulers.
    schedulerAlgorithm string
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memory_oversubscription_enabled bool
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemption_config Mapping[str, bool]
    (map[string]bool) - Options to enable preemption for various schedulers.
    scheduler_algorithm str
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memoryOversubscriptionEnabled Boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig Map<Boolean>
    (map[string]bool) - Options to enable preemption for various schedulers.
    schedulerAlgorithm String
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SchedulerConfig resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing SchedulerConfig Resource

    Get an existing SchedulerConfig resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: SchedulerConfigState, opts?: CustomResourceOptions): SchedulerConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            memory_oversubscription_enabled: Optional[bool] = None,
            preemption_config: Optional[Mapping[str, bool]] = None,
            scheduler_algorithm: Optional[str] = None) -> SchedulerConfig
    func GetSchedulerConfig(ctx *Context, name string, id IDInput, state *SchedulerConfigState, opts ...ResourceOption) (*SchedulerConfig, error)
    public static SchedulerConfig Get(string name, Input<string> id, SchedulerConfigState? state, CustomResourceOptions? opts = null)
    public static SchedulerConfig get(String name, Output<String> id, SchedulerConfigState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    MemoryOversubscriptionEnabled bool
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    PreemptionConfig Dictionary<string, bool>
    (map[string]bool) - Options to enable preemption for various schedulers.
    SchedulerAlgorithm string
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    MemoryOversubscriptionEnabled bool
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    PreemptionConfig map[string]bool
    (map[string]bool) - Options to enable preemption for various schedulers.
    SchedulerAlgorithm string
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memoryOversubscriptionEnabled Boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig Map<String,Boolean>
    (map[string]bool) - Options to enable preemption for various schedulers.
    schedulerAlgorithm String
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memoryOversubscriptionEnabled boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig {[key: string]: boolean}
    (map[string]bool) - Options to enable preemption for various schedulers.
    schedulerAlgorithm string
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memory_oversubscription_enabled bool
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemption_config Mapping[str, bool]
    (map[string]bool) - Options to enable preemption for various schedulers.
    scheduler_algorithm str
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
    memoryOversubscriptionEnabled Boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig Map<Boolean>
    (map[string]bool) - Options to enable preemption for various schedulers.
    schedulerAlgorithm String
    (string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.

    Package Details

    Repository
    HashiCorp Nomad pulumi/pulumi-nomad
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the nomad Terraform Provider.
    nomad logo
    Nomad v2.4.1 published on Wednesday, Oct 30, 2024 by Pulumi