Documentation ¶
Index ¶
- func AddJobStatus(jobMsg *RunJobMessage, status *JobStatus)
- func GetCloudor(username *string, token *string, apiPath string) ([]byte, error)
- func GetJobDuration(jobMsg *RunJobMessage) int64
- func GetMD5(fileName string) (string, error)
- func GetStatusTs(jobMsg *RunJobMessage, status string) int64
- func LastStatus(jobMsg *RunJobMessage) string
- func LoginCloudor(username, password, urlPath string) ([]byte, error)
- func PostCloudor(requestBody *[]byte, username *string, token *string, apiPath string) (*resty.Response, error)
- func TrimQuotes(s string) string
- type Cost
- type CreateRequest
- type CreditSchema
- type Instance
- type JobRunInfo
- type JobStat
- type JobStatus
- type ListClustersResponse
- type ListJobRequest
- type LoginResponse
- type RunJobMessage
- type RunJobRequest
- type SchedulerStatus
- type SignupRequest
- type State
- type Status
- type SupportedOSArch
- type TransInfo
- type TransSchema
- type Vendors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddJobStatus ¶
func AddJobStatus(jobMsg *RunJobMessage, status *JobStatus)
AddJobStatus add a stage to job's runtime info
func GetCloudor ¶
GetCloudor issues a Get to ServerURL
func GetJobDuration ¶
func GetJobDuration(jobMsg *RunJobMessage) int64
GetJobDuration gets the elapsed time in second between finished/failed to started
func GetStatusTs ¶
func GetStatusTs(jobMsg *RunJobMessage, status string) int64
GetStatusTs returns the unix time in second for a status
func LastStatus ¶
func LastStatus(jobMsg *RunJobMessage) string
LastStatus gets the last stage's status
func LoginCloudor ¶
LoginHandler handles login requets
func PostCloudor ¶
func PostCloudor(requestBody *[]byte, username *string, token *string, apiPath string) (*resty.Response, error)
PostCloudor issues a POST to ServerURL
func TrimQuotes ¶
Types ¶
type Cost ¶
type Cost struct { HourRate float64 `json:"hour_rate,omitempty" yaml:"hour_rate"` RateUnit string `json:"rate_unit,omitempty" yaml:"rate_unit"` ComputeCost float64 `json:"compute_cost,omitempty" yaml:"compute_cost"` EgressGB float64 `json:"egress_gb,omitempty" yaml:"egress_gb"` EgressCost float64 `json:"egress_cost,omitempty" yaml:"egress_cost"` AdjustCost float64 `json:"adjust_cost,omitempty" yaml:"adjust_cost"` ReservedCredit float64 `json:"reserved_credit,omitempty" yaml:"reserved_credit"` }
type CreateRequest ¶
type CreateRequest struct { UserName string `json:"user_name,omitempty" yaml:"user_name"` YAML string `json:"yaml,omitempty" yaml:"yaml"` Name string `json:"name,omitempty" yaml:"name"` Image string `json:"image,omitempty" yaml:"image"` }
CreateRequest defines the create request
type CreditSchema ¶
type CreditSchema struct { UserName string `json:"user_name,omitempty" yaml:"user_name"` Credit float64 `json:"credit,omitempty" yaml:"credit"` Reserved float64 `json:"reserved,omitempty" yaml:"reserved"` Unit string `json:"unit,omitempty" yaml:"unit"` }
CreditSchema defines the credit interface
type Instance ¶
type Instance struct { Price float64 `json:"price,omitempty"` Unit string `json:"unit,omitempty"` CPU int32 `json:"cpu,omitempty"` GPU string `json:"gpu,omitempty"` MemoryGiB int32 `json:"memory_gib,omitempty"` }
Instance specifies instance features
type JobRunInfo ¶
type JobRunInfo struct { // unique id, read-only // job name, can be auto-generated JobName string `json:"job_name,omitempty" yaml:"job_name"` TimeoutInMin float64 `json:"timeout_in_min,omitempty" yaml:"timeout_in_min"` Duration int64 `json:"duration,omitempty" yaml:"duration"` Instances *int32 `json:"instances,omitempty" yaml:"instances"` Cost Cost `json:"cost,omitempty" yaml:"cost"` VendorIndex *int32 `json:"vendor_index,omitempty" yaml:"vendor_index"` InputStages []api.StageStorage `json:"input_stages,omitempty" yaml:"input_stages"` OutputStage []api.StageStorage `json:"output_stage,omitempty" yaml:"output_stage"` ImageStage api.StageStorage `json:"image_stage,omitempty" yaml:"image_stage"` WorkingDir string `json:"working_dir,omitempty" yaml:"working_dir"` Stages []Status `json:"stages,omitempty" yaml:"stages"` // Internal usage UpdateNotice api.Notice `json:"update_notice,omitempty" yaml:"update_notice"` Reserved map[string]string `json:"reserved,omitempty" yaml:"reserved"` }
type JobStatus ¶
type JobStatus struct { UserName string `json:"user_name,omitempty" yaml:"user_name"` ID string `json:"id,omitempty" yaml:"id"` Status string `json:"status,omitempty" yaml:"status"` StatusCode int32 `json:"status_code,omitempty" yaml:"status_code"` Vendor string `json:"vendor,omitempty" yaml:"vendor"` Description string `json:"description,omitempty" yaml:"description"` }
JobStatus is used for streaming job status to the client
type ListClustersResponse ¶
type ListJobRequest ¶
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token,omitempty"`
}
LoginResponse defines the body from login request
type RunJobMessage ¶
type RunJobMessage struct { UserName string `json:"user_name,omitempty" yaml:"user_name"` Created int64 `json:"created,omitempty" yaml:"created"` ID string `json:"id,omitempty" yaml:"id"` RunInfo JobRunInfo `json:"run_info,omitempty" yaml:"run_info"` VendorMeta string `json:"vendor_meta,omitempty" yaml:"vendor_meta"` Job api.Job `json:"job,omitempty" yaml:"job"` }
RunJobMessage is the structured data structure for communication
type RunJobRequest ¶
type RunJobRequest struct { UserName string `json:"user_name,omitempty" yaml:"user_name"` JobName string `json:"job_name,omitempty" yaml:"job_name"` RunTag string `json:"run_tag,omitempty" yaml:"run_tag"` DryRun bool `json:"dry_run,omitempty" yaml:"dry_run"` NumInstances int `json:"num_instances,omitempty" yaml:"num_instances"` TimeoutInMin float64 `json:"timeout_in_min,omitempty" yaml:"timeout_in_min"` YAML string `json:"yaml,omitempty" yaml:"yaml"` }
RunJobRequest defines the request for running a job
type SchedulerStatus ¶
type SignupRequest ¶
type Status ¶
type Status struct { ReturnCode int32 `json:"return_code,omitempty" yaml:"return_code"` Status string `json:"status,omitempty" yaml:"status"` Description string `json:"description,omitempty" yaml:"description"` StdOut string `json:"std_out,omitempty" yaml:"stdout"` UnixTime int64 `json:"unix_time,omitempty" yaml:"unix_time"` }
type SupportedOSArch ¶
type SupportedOSArch struct { OS string `json:"os,omitempty" yaml:"os"` Arch string `json:"arch,omitempty" yaml:"arch"` Release string `json:"release,omitempty" yaml:"release"` MD5 string `json:"md5,omitempty" yaml:"md5"` }
SupportedOSArch defines a supported os/arch pairs
type TransInfo ¶
type TransInfo struct { // job or pay Type string `json:"type,omitempty"` JobID string `json:"job_id,omitempty"` CreditBefore float64 `json:"credit_before,omitempty"` CreditAfter float64 `json:"credit_after,omitempty"` }
TransInfo defines a transaction
type TransSchema ¶
type TransSchema struct { UserName string `json:"user_name,omitempty"` ID string `json:"id,omitempty"` TimeStamp int64 `json:"timestamp,omitempty"` Amount float64 `json:"amount"` Unit string `json:"unit,omitempty"` Info TransInfo `json:"info,omitempty"` }
TransSchema defines the json returned from transaction list