cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetupCmd = &cobra.Command{
	Use:    "setup",
	Short:  "Manually set up a launched instance with Cedana defaults and user-provided scripts",
	Long:   "Provide commands to run on the remote instance in user_commands.yaml in the ~/.cedana config folder",
	Hidden: true,
	RunE: func(cmd *cobra.Command, args []string) error {

		db := db.NewDB()
		l := utils.GetLogger()
		jobFile, err := cedana.InitJobFile(jobFile)
		if err != nil {
			l.Fatal().Err(err).Msg("could not set up cedana job")
		}

		instance := db.GetInstanceByProviderId(instanceId)
		if instance.IPAddress == "" {
			return fmt.Errorf("could not find instance with id %s", instanceId)
		}
		cfg, err := utils.InitCedanaConfig()
		if err != nil {
			return fmt.Errorf("could not load spot config %v", err)
		}

		is := InstanceSetup{
			logger:   &l,
			cfg:      cfg,
			instance: *instance,
			jobFile:  jobFile,
		}

		if userOnly {
			is.execUserCommands()
		} else {
			is.ClientSetup(true)
		}
		return nil
	},
}

Functions

func Execute

func Execute() error

func SetVersionInfo

func SetVersionInfo(version, commit, date string)

used in main.go to set version info

func StringPtrToString

func StringPtrToString(p *string) string

stupid AWS returns everything as a pointer

Types

type Bootstrap

type Bootstrap struct {
	// contains filtered or unexported fields
}

func (*Bootstrap) AWSBootstrap

func (b *Bootstrap) AWSBootstrap()

TODO: Should check for launch templates?

func (*Bootstrap) AzureBootstrap

func (b *Bootstrap) AzureBootstrap()

func (*Bootstrap) CreateAWSKeyFile

func (b *Bootstrap) CreateAWSKeyFile(region string)

func (*Bootstrap) GCPBootstrap

func (b *Bootstrap) GCPBootstrap()

type CLIDaemon

type CLIDaemon struct {
	// contains filtered or unexported fields
}

func NewCLIDaemon

func NewCLIDaemon() *CLIDaemon

func (*CLIDaemon) PollProvider

func (cd *CLIDaemon) PollProvider(clientID, jobID string)

PollingDaemon checks for provider events and sends a checkpoint status over NATS. Needs to be async (so can't use the command channel) because it might have to be run on the user's machine.

func (*CLIDaemon) PollProviderOnce

func (cd *CLIDaemon) PollProviderOnce(clientID, jobID string) error

func (*CLIDaemon) Start

func (cd *CLIDaemon) Start(orchestratorID string, jobID string, clientID string)

func (*CLIDaemon) UpdateJobStatus

func (cd *CLIDaemon) UpdateJobStatus(jobID string) error

UpdateJobStatus receives on NATS messages from the orchestrator about successful checkpoints/restores and on the state of the running task.

type Commune

type Commune struct {
	// contains filtered or unexported fields
}

func NewCommune

func NewCommune(jobID string) (*Commune, error)

type InstanceSetup

type InstanceSetup struct {
	// contains filtered or unexported fields
}

func BuildInstanceSetup

func BuildInstanceSetup(i cedana.Instance, job cedana.Job) *InstanceSetup

func (*InstanceSetup) ClientSetup

func (is *InstanceSetup) ClientSetup(runTask bool) error

Runs cedana-specific and user-specified instantiation scripts for a client instance in an SSH session.

func (*InstanceSetup) CreateConn

func (is *InstanceSetup) CreateConn() (*ssh.Client, error)

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

the batch command launches 100 of these in parallel!

func (*Runner) CreateNATSStream

func (r *Runner) CreateNATSStream() error

func (*Runner) CreateObjectStores

func (r *Runner) CreateObjectStores() error

creates object stores for checkpoints & for workdirs

func (*Runner) PublishJob

func (r *Runner) PublishJob() error

func (*Runner) SetupNATSForJob

func (r *Runner) SetupNATSForJob() error

Jump to

Keyboard shortcuts

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