Documentation ¶
Index ¶
- type CancelTaskResponse
- type CreateTaskResponse
- type Executor
- type ExecutorLog
- type FileType
- type Input
- type ListTasksResponse
- type Metrics
- type Node
- type Organization
- type Output
- type OutputFileLog
- type Resources
- type ServiceInfo
- type ServiceType
- type State
- type Task
- type TaskLog
- type Usage
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelTaskResponse ¶
type CancelTaskResponse struct { }
CancelTaskResponse represents that a task was canceled
type CreateTaskResponse ¶
type CreateTaskResponse struct {
ID string `json:"id"`
}
CreateTaskResponse represents a task submitted and approved by the system
type Executor ¶
type Executor struct { // Name of the container image Image string `json:"image"` // A sequence of program arguments to execute, where the first argument is the program to execute Command []string `json:"command"` // The working directory that the command will be executed in WorkDir string `json:"workdir,omitempty"` // Path inside the container to a file which will be piped to the executor's stdin Stdin string `json:"stdin,omitempty"` // Path inside the container to a file where the executor's stdout will be written to Stdout string `json:"stdout,omitempty"` // Path inside the container to a file where the executor's stderr will be written to Stderr string `json:"stderr,omitempty"` // Environment variables to set within the container Env map[string]string `json:"env,omitempty"` }
Executor describes a command to be executed, and its environment.
type ExecutorLog ¶
type ExecutorLog struct { ExitCode int32 `json:"exit_code"` // Exit code StartTime time.Time `json:"start_time,omitempty"` // Time the executor started EndTime time.Time `json:"end_time,omitempty"` // Time the executor ended Stdout string `json:"stdout,omitempty"` // Stdout content Stderr string `json:"stderr,omitempty"` // Stderr content }
ExecutorLog represents processing times and logs of an executor
type Input ¶
type Input struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` URL string `json:"url"` Path string `json:"path"` Type FileType `json:"type"` Content string `json:"content,omitempty"` }
Input represents an input file to be used by task.
type ListTasksResponse ¶
type ListTasksResponse struct { Tasks []*Task `json:"tasks"` NextPageToken string `json:"next_page_token,omitempty"` }
ListTasksResponse represents a list of tasks previous submitted to system
type Metrics ¶ added in v1.1.0
type Metrics struct { // Total CPU time in nanoseconds across all cores. CPUTime uint64 `json:"cpu_time"` // Maximum CPU percentage ever recorded. CPUPercentage float64 `json:"cpu_percentage"` // Maximum memory used ever recorded in bytes. Memory uint64 `json:"memory"` }
Metrics represents a active computing node.
type Node ¶
type Node struct { Host string `json:"host" bson:"_id"` Port string `json:"port"` Active bool `json:"active"` CPUCores int32 `json:"cpu_cores"` RAMGb float64 `json:"ram_gb"` // Usage keeps real-time allocated resources in memory. It is not stored in database. Usage *Usage `json:"usage" bson:"-"` }
Node is a computing node that accepts and executes tasks. It has maximum allowed (Info) and real-time allocated computing resources (Usage). Host is used as its unique identifier.
type Organization ¶ added in v1.3.0
type Output ¶
type Output struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` URL string `json:"url"` Path string `json:"path"` Type FileType `json:"type"` }
Output represents a file generated by task
type OutputFileLog ¶
type OutputFileLog struct { URL string `json:"url"` Path string `json:"path"` SizeBytes string `json:"size_bytes"` }
OutputFileLog represents a log file
type Resources ¶
type Resources struct { CPUCores int32 `json:"cpu_cores,omitempty"` RAMGb float64 `json:"ram_gb,omitempty"` DiskGb float64 `json:"disk_gb,omitempty"` Zones []string `json:"zones,omitempty"` Preemptible bool `json:"preemptible,omitempty"` }
Resources represents computing requirements to run task
type ServiceInfo ¶
type ServiceInfo struct { ID string `json:"id"` Name string `json:"name"` Type *ServiceType `json:"type"` Description string `json:"description"` Organization *Organization `json:"organization"` ContactURL string `json:"contactUrl"` DocumentationURL string `json:"documentationUrl,omitempty"` Storage []string `json:"storage,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Environment string `json:"environment"` Version string `json:"version"` }
ServiceInfo describes information about the service, such as storage details, resource availability, and other documentation.
type ServiceType ¶ added in v1.3.0
type State ¶
type State string
State of a task
const ( // Unknown means task state is not defined Unknown State = "UNKNOWN" // Queued means task was submitted and waiting Queued State = "QUEUED" // Initializing means required files are be gathering before execution // for example, downloading Docker image Initializing State = "INITIALIZING" // Running means tasks is been executed by some worker node Running State = "RUNNING" // Paused is not used Paused State = "PAUSED" // Complete means task was terminated successfully, aka 0 return code Complete State = "COMPLETE" // ExecutorError means something had happen to worker node when running task ExecutorError State = "EXECUTOR_ERROR" // SystemError means something went wrong with the worker when running task SystemError State = "SYSTEM_ERROR" // Canceled means task was canceled Canceled State = "CANCELED" )
func ActiveStates ¶ added in v1.1.0
func ActiveStates() []State
ActiveStates returns task states considered active.
func ErrorStates ¶ added in v1.1.0
func ErrorStates() []State
ErrorStates returns task states considered failed.
func TerminatedStates ¶ added in v1.1.0
func TerminatedStates() []State
TerminatedStates returns task states considered completed.
type Task ¶
type Task struct { ID string `json:"id" bson:"_id"` State State `json:"state"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Created *time.Time `json:"creation_time,omitempty"` Resources *Resources `json:"resources,omitempty"` Executors []Executor `json:"executors,omitempty"` Inputs []*Input `json:"inputs,omitempty"` Outputs []*Output `json:"outputs,omitempty"` Volumes []string `json:"volumes,omitempty"` Tags map[string]string `json:"tags,omitempty"` Logs []*TaskLog `json:"logs,omitempty"` // RNNR specific fields. Host string `json:"host,omitempty"` Metrics *Metrics `json:"metrics,omitempty"` }
Task is a collection of command to be executed to process data
func (*Task) Active ¶
Active returns true if task is active (queued, initializing, running and paused).
func (*Task) Failed ¶ added in v1.1.0
Failed returns true if task failed (executor error and system error).
func (*Task) Terminated ¶ added in v1.1.0
Terminated returns true if task is completed (complete, executor error, system error and canceled).
type TaskLog ¶ added in v1.3.0
type TaskLog struct { // ExecutorLogs for each executor ExecutorLogs []*ExecutorLog `json:"logs,omitempty"` // Arbitrary logging metadata included by the implementation Metadata map[string]string `json:"metadata,omitempty"` // When the task started StartTime *time.Time `json:"start_time,omitempty"` // When the task ended EndTime *time.Time `json:"end_time,omitempty"` // Information about all output files Outputs []*OutputFileLog `json:"outputs,omitempty"` // System logs are any logs the system decides are relevant, which are not tied directly to an Executor process SystemLogs []string `json:"system_logs,omitempty"` }
TaskLog represents processing times and logs of a task
type Usage ¶
type Usage struct { Tasks int `json:"tasks"` CPUCores int32 `json:"cpu_cores"` RAMGb float64 `json:"ram_gb"` }
Usage has the amount of computings resources already in use.