task_config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DurationConfig

type DurationConfig struct {
	Since string `yaml:"since" required:"true"`
	Until string `yaml:"until" required:"true"`
}

type NetworkConfig

type NetworkConfig struct {
	In   string `yaml:"in" required:"true"`
	Out  string `yaml:"out" required:"true"`
	Type string `yaml:"type" required:"true"`
}

type OrderConfig

type OrderConfig struct {
	ID         string     `yaml:"id"`
	BuyerID    string     `yaml:"buyer_id"`
	SupplierID string     `yaml:"supplier_id"`
	Price      string     `yaml:"price" required:"true"`
	OrderType  string     `yaml:"order_type" required:"true"`
	Slot       SlotConfig `yaml:"slot" required:"true"`
}

func (*OrderConfig) IntoOrder

func (c *OrderConfig) IntoOrder() (*structs.Order, error)

type ResourcesConfig

type ResourcesConfig struct {
	Cpu        uint64             `yaml:"cpu_cores" required:"true"`
	Ram        string             `yaml:"ram_bytes" required:"true"`
	Gpu        string             `yaml:"gpu_count" required:"true"`
	Storage    string             `yaml:"storage" required:"true"`
	Network    NetworkConfig      `yaml:"network" required:"true"`
	Properties map[string]float64 `yaml:"properties" required:"true"`
}

type SlotConfig

type SlotConfig struct {
	Duration  string          `yaml:"duration" required:"true"`
	Resources ResourcesConfig `yaml:"resources" required:"true"`
}

func (*SlotConfig) IntoSlot

func (c *SlotConfig) IntoSlot() (*structs.Slot, error)

type TaskConfig

type TaskConfig interface {
	GetImageName() string
	GetEntrypoint() string
	GetSSHKey() string
	GetEnvVars() map[string]string
	GetCommitOnStop() bool

	GetRegistryName() string
	GetRegistryAuth() string

	GetMinersPreferred() []string
	GetCPUCount() uint64
	GetRAMCount() uint64
	GetCPUType() string
	GetGPURequirement() bool
	GetGPUType() string
}

TaskConfig describe how to start task (docker image) on Miner

func LoadConfig

func LoadConfig(path string) (TaskConfig, error)

type YamlConfig

type YamlConfig struct {
	Task task `yaml:"task" required:"true"`
	// RamCount this field is temporary exportable because of bug in configor
	// https://github.com/jinzhu/configor/issues/23
	// maybe it will be better to fork configor and fix this bug
	RamCount uint64 `yaml:"-"`
}

func (*YamlConfig) GetCPUCount

func (yc *YamlConfig) GetCPUCount() uint64

func (*YamlConfig) GetCPUType

func (yc *YamlConfig) GetCPUType() string

func (*YamlConfig) GetCommitOnStop

func (yc *YamlConfig) GetCommitOnStop() bool

func (*YamlConfig) GetEntrypoint

func (yc *YamlConfig) GetEntrypoint() string

func (*YamlConfig) GetEnvVars

func (yc *YamlConfig) GetEnvVars() map[string]string

func (*YamlConfig) GetGPURequirement

func (yc *YamlConfig) GetGPURequirement() bool

func (*YamlConfig) GetGPUType

func (yc *YamlConfig) GetGPUType() string

func (*YamlConfig) GetImageName

func (yc *YamlConfig) GetImageName() string

func (*YamlConfig) GetMinersPreferred

func (yc *YamlConfig) GetMinersPreferred() []string

func (*YamlConfig) GetRAMCount

func (yc *YamlConfig) GetRAMCount() uint64

func (*YamlConfig) GetRegistryAuth

func (yc *YamlConfig) GetRegistryAuth() string

func (*YamlConfig) GetRegistryName

func (yc *YamlConfig) GetRegistryName() string

func (*YamlConfig) GetSSHKey

func (yc *YamlConfig) GetSSHKey() string

Jump to

Keyboard shortcuts

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