docker

package
v0.4.159 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package docker is marked for deletion. See `service` module.

`docker` package is used to run docker containers for ML on GPU/CPU usecase.

Index

Constants

This section is empty.

Variables

View Source
var (
	DoneCleanup chan bool
)

Functions

func GetContainersFromImage added in v0.4.159

func GetContainersFromImage(ctx context.Context, imageID string) ([]types.Container, error)

func GetLogs

func GetLogs(ctx context.Context, contName string) (io.ReadCloser, error)

GetLogs return logs from the container io.ReadCloser. It's the caller duty duty to do a stdcopy.StdCopy. Any other method might render unknown unicode character as log output has both stt ctx context.Context dc *client.Client gHealthy booldout and stderr. That starting has info if that line is stderr or stdout.

func HandleDeployment

func HandleDeployment(ctx context.Context, depReq models.DeploymentRequest) (models.DeploymentResponse, error)

HandleDeployment does following docker based actions in the sequence: Pull image, run container, get logs, send log to the requester

func PullImage

func PullImage(ctx context.Context, imageName string) error

PullImage is a wrapper around Docker SDK's function with same name.

func RemoveImage added in v0.4.159

func RemoveImage(ctx context.Context, imageID string) error

func RunContainer

func RunContainer(ctx context.Context, depReq models.DeploymentRequest, createdLog LogbinResponse, resCh chan<- models.DeploymentResponse, servicePK uint, chosenGPUVendor library.GPUVendor)

RunContainer goes through the process of setting constraints, specifying image name and cmd. It starts a container and posts log update every logUpdateDuration.

func SearchContianersByImage added in v0.4.159

func SearchContianersByImage(ctx context.Context, imageID string) ([]types.Container, error)

SearchContianersByImage gets all containers given an imageID string.

func SearchImagesByRefrence added in v0.4.159

func SearchImagesByRefrence(ctx context.Context, reference string) ([]types.ImageSummary, error)

SearchImagesByRefrence gets all container images given a reference string. The refrence string should be a regex compilable pattern that will be searched against image name (RepoTags) and digests.

func StartCleanup added in v0.4.159

func StartCleanup()

func StopAndRemoveContainer added in v0.4.159

func StopAndRemoveContainer(ctx context.Context, containerID string) error

StopAndRemoveContainer stops and removes a container given its ID

Types

type LogAppend added in v0.4.118

type LogAppend struct {
	Stdout string `json:"stdout"`
	Stderr string `json:"stderr"`
}

type LogbinResponse added in v0.4.118

type LogbinResponse struct {
	ID        string    `json:"id"`
	RawUrl    string    `json:"raw_url"`
	CreatedAt time.Time `json:"created_at"`
}

type NewLog added in v0.4.118

type NewLog struct {
	Title  string `json:"title"`
	Stdout string `json:"stdout"`
	Stderr string `json:"stderr"`
}

Jump to

Keyboard shortcuts

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