provconfig

package
v0.0.0-...-3511abf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MaxNamePrefixLen = 30

MaxNamePrefixLen is the max length of the instance name prefix. The full name of an instance should be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? as suggested here: https://cloud.google.com/compute/docs/reference/rest/v1/instances/insert. We concatenate the prefix with a pet name to make an instance name. Here we made a rough estimation of the max length of name prefix to be 30.

View Source
const SpotPriceNotSetPlaceholder = "OnDemand"

SpotPriceNotSetPlaceholder set placeholder.

Variables

This section is empty.

Functions

func GetCPUPlatform

func GetCPUPlatform(machineType string) string

GetCPUPlatform returns CPU platform.

Types

type AWSClusterConfig

type AWSClusterConfig struct {
	Region string `json:"region"`

	RootVolumeSize int    `json:"root_volume_size"`
	ImageID        string `json:"image_id"`

	TagKey       string `json:"tag_key"`
	TagValue     string `json:"tag_value"`
	InstanceName string `json:"instance_name"`

	SSHKeyName            string              `json:"ssh_key_name"`
	NetworkInterface      ec2NetworkInterface `json:"network_interface"`
	IamInstanceProfileArn string              `json:"iam_instance_profile_arn"`

	InstanceType  Ec2InstanceType `json:"instance_type"`
	InstanceSlots *int            `json:"instance_slots,omitempty"`

	LogGroup  string `json:"log_group"`
	LogStream string `json:"log_stream"`

	SpotEnabled  bool   `json:"spot"`
	SpotMaxPrice string `json:"spot_max_price"`

	CustomTags []*ec2Tag `json:"custom_tags"`

	CPUSlotsAllowed bool `json:"cpu_slots_allowed"`
}

AWSClusterConfig describes the configuration for an EC2 cluster managed by Determined.

func (AWSClusterConfig) Accelerator

func (c AWSClusterConfig) Accelerator() string

Accelerator returns the GPU accelerator for the instance.

func (*AWSClusterConfig) BuildDockerLogString

func (c *AWSClusterConfig) BuildDockerLogString() string

BuildDockerLogString build docker log string.

func (*AWSClusterConfig) InitDefaultValues

func (c *AWSClusterConfig) InitDefaultValues() error

InitDefaultValues init default values.

func (AWSClusterConfig) SlotType

func (c AWSClusterConfig) SlotType() device.Type

SlotType returns the type of the slot.

func (AWSClusterConfig) SlotsPerInstance

func (c AWSClusterConfig) SlotsPerInstance() int

SlotsPerInstance returns the number of slots per instance.

func (*AWSClusterConfig) UnmarshalJSON

func (c *AWSClusterConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (AWSClusterConfig) Validate

func (c AWSClusterConfig) Validate() []error

Validate implements the check.Validatable interface.

type Config

type Config struct {
	MasterURL              string `json:"master_url"`
	MasterCertName         string `json:"master_cert_name"`
	StartupScript          string `json:"startup_script"`
	ContainerStartupScript string `json:"container_startup_script"`
	AgentDockerNetwork     string `json:"agent_docker_network"`
	AgentDockerRuntime     string `json:"agent_docker_runtime"`
	AgentDockerImage       string `json:"agent_docker_image"`
	// deprecated, no longer in use.
	AgentFluentImage        string            `json:"agent_fluent_image"`
	AgentReconnectAttempts  int               `json:"agent_reconnect_attempts"`
	AgentReconnectBackoff   int               `json:"agent_reconnect_backoff"`
	AgentConfigFileContents json.RawMessage   `json:"agent_config_file_contents"`
	AWS                     *AWSClusterConfig `union:"type,aws" json:"-"`
	GCP                     *GCPClusterConfig `union:"type,gcp" json:"-"`
	HPC                     *HpcClusterConfig `union:"type,hpc" json:"-"`
	MaxIdleAgentPeriod      model.Duration    `json:"max_idle_agent_period"`
	MaxAgentStartingPeriod  model.Duration    `json:"max_agent_starting_period"`
	MinInstances            int               `json:"min_instances"`
	MaxInstances            int               `json:"max_instances"`
	LaunchErrorTimeout      *model.Duration   `json:"launch_error_timeout"`
	LaunchErrorRetries      int               `json:"launch_error_retries"`
}

Config describes config for provisioner.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration of the provisioner.

func (*Config) InitMasterAddress

func (c *Config) InitMasterAddress() error

InitMasterAddress init master address.

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Config) Printable

func (c Config) Printable() Config

Printable returns a printable object.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Config) Validate

func (c Config) Validate() []error

Validate implements the check.Validatable interface.

type Ec2InstanceType

type Ec2InstanceType string

Ec2InstanceType is Ec2InstanceType.

func (Ec2InstanceType) Name

func (t Ec2InstanceType) Name() string

Name returns the string representation of instance type.

func (Ec2InstanceType) Slots

func (t Ec2InstanceType) Slots() int

Slots returns number of slots.

type GCPClusterConfig

type GCPClusterConfig struct {
	BaseConfig *compute.InstanceProperties `json:"base_config"`

	Project string `json:"project"`
	Zone    string `json:"zone"`

	BootDiskSize        int    `json:"boot_disk_size"`
	BootDiskSourceImage string `json:"boot_disk_source_image"`
	BootDiskType        string `json:"boot_disk_type"`

	Labels     map[string]string `json:"labels"`
	LabelKey   string            `json:"label_key"`
	LabelValue string            `json:"label_value"`
	NamePrefix string            `json:"name_prefix"`

	NetworkInterface gceNetworkInterface `json:"network_interface"`
	NetworkTags      []string            `json:"network_tags"`
	ServiceAccount   gceServiceAccount   `json:"service_account"`

	InstanceType gceInstanceType `json:"instance_type"`

	OperationTimeoutPeriod model.Duration `json:"operation_timeout_period"`
	CPUSlotsAllowed        bool           `json:"cpu_slots_allowed"`

	UseCloudLogging bool `json:"use_cloud_logging"`
}

GCPClusterConfig describes the configuration for a GCP cluster managed by Determined.

func DefaultGCPClusterConfig

func DefaultGCPClusterConfig() *GCPClusterConfig

DefaultGCPClusterConfig returns the default configuration of the gcp cluster.

func (GCPClusterConfig) Accelerator

func (c GCPClusterConfig) Accelerator() string

Accelerator returns the GPU accelerator for the instance.

func (GCPClusterConfig) BuildDockerLogString

func (c GCPClusterConfig) BuildDockerLogString() string

BuildDockerLogString add log driver if necessary.

func (*GCPClusterConfig) InitDefaultValues

func (c *GCPClusterConfig) InitDefaultValues() error

InitDefaultValues init default values.

func (*GCPClusterConfig) InstanceProperties

func (c *GCPClusterConfig) InstanceProperties() *compute.InstanceProperties

InstanceProperties GCP cluster config.

func (GCPClusterConfig) SlotType

func (c GCPClusterConfig) SlotType() device.Type

SlotType returns the type of the slot.

func (GCPClusterConfig) SlotsPerInstance

func (c GCPClusterConfig) SlotsPerInstance() int

SlotsPerInstance returns the number of slots per instance.

func (*GCPClusterConfig) UnmarshalJSON

func (c *GCPClusterConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (GCPClusterConfig) Validate

func (c GCPClusterConfig) Validate() []error

Validate implements the check.Validatable interface.

type HpcClusterConfig

type HpcClusterConfig struct {
	Partition string `json:"partition"`
}

HpcClusterConfig describes the configuration for a HPC cluster managed by Determined.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL