impl

package
v0.0.0-...-f628d08 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServerURL string = "https://cloudor.dev"

Variables

This section is empty.

Functions

func CheckingJob

func CheckingJob(jobMsg *api.RunJobMessage, username *string, token *string) (*api.RunJobMessage, error)

func DownloadFromURL

func DownloadFromURL(url string, filename string) error

func DownloadSelfFromURL

func DownloadSelfFromURL(username, token *string, apiPath string)

func DownloadTmpFromURL

func DownloadTmpFromURL(url string) (string, error)

func GetClusterStatus

func GetClusterStatus(userName, token *string) api.SchedulerStatus

ListClusters

func GetCredit

func GetCredit(userName, token *string) (*request.CreditSchema, error)

func GetJobs

func GetJobs(userName, token *string) (*[]api.RunJobMessage, error)

GetJobs returns recent jobs issued by a user

func GetPollInterval

func GetPollInterval(jobMessage *api.RunJobMessage) int64

func GetStatusCode

func GetStatusCode(jobMsg *api.RunJobMessage, status string) (int, error)

GetStatusTs returns the unix time in second for a status

func GetTrans

func GetTrans(userName, token *string) (*[]request.TransSchema, error)

GetTrans returns recent jobs issued by a user

func GetUpdate

func GetUpdate(userName, token *string, os, arch, release string) (*[]request.SupportedOSArch, error)

GetUpdate returns supported upda

func GetVendors

func GetVendors(userName, token *string) (*request.Vendors, error)

GetVendors returns supported vendors by cloudor

func ListClusters

func ListClusters(userName, token *string) *[]request.ListClustersResponse

ListClusters

func ListUpdates

func ListUpdates(userName, token *string) (*[]request.SupportedOSArch, error)

ListUpdates returns supported updates

func NewJobByFile

func NewJobByFile(filePath string) (*api.Job, error)

func UnmarshalJobMsg

func UnmarshalJobMsg(resp *resty.Response) (*api.RunJobMessage, error)

func Upload

func Upload(jobMsg *api.RunJobMessage) error

Upload image and inputs, if applicable

func UploadDirToS3

func UploadDirToS3(localDir string, s3Pair api.PresignPair) error

func UploadImage

func UploadImage(jobMsg *api.RunJobMessage) error

UploadImage uploads the local image file to a stage area (S3 presigned URL)

func UploadInputs

func UploadInputs(jobMsg *api.RunJobMessage) error

UploadInputs uploads

Types

type Instance

type Instance struct {
	Vendor       string           `json:"vendor,omitempty"`
	Region       string           `json:"region,omitempty"`
	InstanceType string           `json:"instance_type,omitempty"`
	Instance     request.Instance `json:"instance,omitempty"`
}

Instance specifies instance features

func FilterVendors

func FilterVendors(vendors *request.Vendors, selVendor string, selRegion string) []Instance

type JobStatus

type JobStatus struct {
	UserName    string `json:"user_name,omitempty"`
	ID          string `json:"id,omitempty"`
	Status      string `json:"status,omitempty"`
	StatusCode  int    `json:"status_code,omitempty"`
	Vendor      string `json:"vendor,omitempty"`
	Description string `json:"description,omitempty"`
}

JobStatus is used for streaming job status to the client

type RunArgs

type RunArgs struct {
	File string
	Tag  string
	Name string
	// Vendor       string
	// Region       string
	// InstanceType string
	DryRun       bool
	Detach       bool
	TimeoutInMin float64
	NumInstances int
	Input        string
	InputMount   string
	Output       string
	OutputMount  string
	Args         []string
}

type RunEngine

type RunEngine struct {
	RunArgs *RunArgs
	Job     *api.Job
}

func NewRunEngine

func NewRunEngine(runArgs *RunArgs) (*RunEngine, error)

func (*RunEngine) Fetch

func (run *RunEngine) Fetch(jobMessage *api.RunJobMessage) error

func (*RunEngine) Run

func (run *RunEngine) Run(username, token *string) error

type TableView

type TableView struct {
	Table *tablewriter.Table
}

TableView shows the API list nicely

func NewTableView

func NewTableView() *TableView

NewTableView creates the Table

func (TableView) View

func (v TableView) View(jobs *[]api.RunJobMessage)

View implements the View interface

func (TableView) ViewTrans

func (v TableView) ViewTrans(transactions *[]request.TransSchema)

View implements the View interface

func (TableView) ViewUpdates

func (v TableView) ViewUpdates(releases *[]request.SupportedOSArch)

View implements the View interface

func (TableView) ViewVendors

func (v TableView) ViewVendors(instances *[]Instance)

ViewVendors tabulates the vendor

type View

type View interface {
	// contains filtered or unexported methods
}

View interface

Jump to

Keyboard shortcuts

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