Documentation ¶
Index ¶
- Constants
- func AuthInterceptor(token string) grpc.UnaryClientInterceptor
- func GetPodAddr() (string, error)
- func GetProcCurrentCPUMillicores(cpuTime float64, prevCPUTime float64, systemCPUTime float64, ...) float64
- func GetRandomFreePort() (int, error)
- func GetSystemCPU() (float64, error)
- type AWSCredentialProvider
- type AssignedGpuDevices
- type CacheClient
- type ContainerCudaManager
- func (c *ContainerCudaManager) AssignGpuDevices(containerId string, gpuCount uint32) (*AssignedGpuDevices, error)
- func (c *ContainerCudaManager) InjectCudaEnvVars(env []string, options *ContainerOptions) ([]string, bool)
- func (c *ContainerCudaManager) InjectCudaMounts(mounts []specs.Mount) []specs.Mount
- func (c *ContainerCudaManager) UnassignGpuDevices(containerId string)
- type ContainerInstance
- type ContainerLogMessage
- type ContainerLogger
- type ContainerOptions
- type CredentialProvider
- type DockerCredentialProvider
- type FileLock
- type GpuMemoryUsageStats
- type ImageClient
- func (c *ImageClient) Archive(ctx context.Context, bundlePath string, imageId string, progressChan chan int) error
- func (c *ImageClient) Cleanup() error
- func (c *ImageClient) PullAndArchiveImage(ctx context.Context, sourceImage string, imageId string, creds *string) error
- func (c *ImageClient) PullLazy(imageId string) error
- type Mount
- type ProcUtil
- type RunCServer
- func (s *RunCServer) RunCArchive(req *pb.RunCArchiveRequest, stream pb.RunCService_RunCArchiveServer) error
- func (s *RunCServer) RunCExec(ctx context.Context, in *pb.RunCExecRequest) (*pb.RunCExecResponse, error)
- func (s *RunCServer) RunCKill(ctx context.Context, in *pb.RunCKillRequest) (*pb.RunCKillResponse, error)
- func (s *RunCServer) RunCStatus(ctx context.Context, in *pb.RunCStatusRequest) (*pb.RunCStatusResponse, error)
- func (s *RunCServer) RunCStreamLogs(req *pb.RunCStreamLogsRequest, stream pb.RunCService_RunCStreamLogsServer) error
- func (s *RunCServer) Start() error
- type Worker
- type WorkerMetrics
Constants ¶
View Source
const ExitCodeSigterm = 143
Variables ¶
This section is empty.
Functions ¶
func AuthInterceptor ¶
func AuthInterceptor(token string) grpc.UnaryClientInterceptor
func GetPodAddr ¶
GetPodAddr gets the IP from the POD_IP env var. Returns an error if it fails to retrieve an IP.
func GetRandomFreePort ¶
func GetSystemCPU ¶
Types ¶
type AWSCredentialProvider ¶
type AWSCredentialProvider struct { CredentialProvider Region string AccessKey string SecretKey string }
AWS auth provider
func (*AWSCredentialProvider) GetAuthString ¶
func (p *AWSCredentialProvider) GetAuthString() (string, error)
func (*AWSCredentialProvider) GetAuthorizationToken ¶
func (p *AWSCredentialProvider) GetAuthorizationToken() (string, error)
func (*AWSCredentialProvider) GetUsername ¶
func (p *AWSCredentialProvider) GetUsername() string
type AssignedGpuDevices ¶
type AssignedGpuDevices struct {
// contains filtered or unexported fields
}
func (*AssignedGpuDevices) String ¶
func (d *AssignedGpuDevices) String() string
type CacheClient ¶
type CacheClient struct { ServiceUrl string ServiceToken string // contains filtered or unexported fields }
func NewCacheClient ¶
func NewCacheClient(serviceUrl, serviceToken string) (*CacheClient, error)
func (*CacheClient) Close ¶
func (c *CacheClient) Close() error
func (*CacheClient) GetContent ¶
func (*CacheClient) StoreContent ¶
func (c *CacheClient) StoreContent(chunks chan []byte) (string, error)
type ContainerCudaManager ¶
type ContainerCudaManager struct {
// contains filtered or unexported fields
}
func NewContainerCudaManager ¶
func NewContainerCudaManager(gpuCount uint32) *ContainerCudaManager
func (*ContainerCudaManager) AssignGpuDevices ¶
func (c *ContainerCudaManager) AssignGpuDevices(containerId string, gpuCount uint32) (*AssignedGpuDevices, error)
func (*ContainerCudaManager) InjectCudaEnvVars ¶
func (c *ContainerCudaManager) InjectCudaEnvVars(env []string, options *ContainerOptions) ([]string, bool)
func (*ContainerCudaManager) InjectCudaMounts ¶
func (c *ContainerCudaManager) InjectCudaMounts(mounts []specs.Mount) []specs.Mount
func (*ContainerCudaManager) UnassignGpuDevices ¶
func (c *ContainerCudaManager) UnassignGpuDevices(containerId string)
type ContainerInstance ¶
type ContainerLogMessage ¶
type ContainerLogger ¶
type ContainerLogger struct {
// contains filtered or unexported fields
}
func (*ContainerLogger) CaptureLogs ¶
func (r *ContainerLogger) CaptureLogs(containerId string, outputChan chan common.OutputMsg) error
type ContainerOptions ¶
type ContainerOptions struct { BindPort int InitialSpec *specs.Spec }
type CredentialProvider ¶
type DockerCredentialProvider ¶
type DockerCredentialProvider struct { CredentialProvider Username string Password string }
Docker provider
func (*DockerCredentialProvider) GetAuthString ¶
func (p *DockerCredentialProvider) GetAuthString() (string, error)
func (*DockerCredentialProvider) GetAuthorizationToken ¶
func (p *DockerCredentialProvider) GetAuthorizationToken() (string, error)
func (*DockerCredentialProvider) GetUsername ¶
func (p *DockerCredentialProvider) GetUsername() string
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
func NewFileLock ¶
type GpuMemoryUsageStats ¶
func GetGpuMemoryUsage ¶
func GetGpuMemoryUsage(deviceIndex int) (GpuMemoryUsageStats, error)
GetGpuMemoryUsage retrieves the memory usage of a specific NVIDIA GPU. It returns the total and used memory in bytes.
type ImageClient ¶
type ImageClient struct {
// contains filtered or unexported fields
}
func NewImageClient ¶
func NewImageClient(config types.ImageServiceConfig, workerId string, workerRepo repository.WorkerRepository) (*ImageClient, error)
func (*ImageClient) Archive ¶
func (c *ImageClient) Archive(ctx context.Context, bundlePath string, imageId string, progressChan chan int) error
Generate and upload archived version of the image for distribution
func (*ImageClient) Cleanup ¶
func (c *ImageClient) Cleanup() error
func (*ImageClient) PullAndArchiveImage ¶
func (*ImageClient) PullLazy ¶
func (c *ImageClient) PullLazy(imageId string) error
type ProcUtil ¶
func NewProcUtil ¶
type RunCServer ¶
type RunCServer struct { pb.UnimplementedRunCServiceServer // contains filtered or unexported fields }
func NewRunCServer ¶
func NewRunCServer(containerInstances *common.SafeMap[*ContainerInstance], imageClient *ImageClient) (*RunCServer, error)
func (*RunCServer) RunCArchive ¶
func (s *RunCServer) RunCArchive(req *pb.RunCArchiveRequest, stream pb.RunCService_RunCArchiveServer) error
func (*RunCServer) RunCExec ¶
func (s *RunCServer) RunCExec(ctx context.Context, in *pb.RunCExecRequest) (*pb.RunCExecResponse, error)
Execute an arbitary command inside a running container
func (*RunCServer) RunCKill ¶
func (s *RunCServer) RunCKill(ctx context.Context, in *pb.RunCKillRequest) (*pb.RunCKillResponse, error)
func (*RunCServer) RunCStatus ¶
func (s *RunCServer) RunCStatus(ctx context.Context, in *pb.RunCStatusRequest) (*pb.RunCStatusResponse, error)
func (*RunCServer) RunCStreamLogs ¶
func (s *RunCServer) RunCStreamLogs(req *pb.RunCStreamLogsRequest, stream pb.RunCService_RunCStreamLogsServer) error
func (*RunCServer) Start ¶
func (s *RunCServer) Start() error
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func (*Worker) RunContainer ¶
func (s *Worker) RunContainer(request *types.ContainerRequest) error
Spawn a single container and stream output to stdout/stderr
func (*Worker) SpawnAsync ¶
func (s *Worker) SpawnAsync(request *types.ContainerRequest, bundlePath string, spec *specs.Spec) error
Invoke a runc container using a predefined config spec
type WorkerMetrics ¶
type WorkerMetrics struct {
// contains filtered or unexported fields
}
func NewWorkerMetrics ¶
func NewWorkerMetrics( ctx context.Context, workerId string, workerRepo repo.WorkerRepository, config types.MonitoringConfig, ) (*WorkerMetrics, error)
func (*WorkerMetrics) EmitContainerUsage ¶
func (wm *WorkerMetrics) EmitContainerUsage(request *types.ContainerRequest, done chan bool)
Periodically send metrics to track container duration
Click to show internal directories.
Click to hide internal directories.