lib

package
v0.0.0-...-e371549 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJobImage

func BuildJobImage(ctx context.Context, jobID, builder string, fqdnToPush bool) (*string, error)

BuildJobImage builds a docker image for the job

func BuildSingularityImage

func BuildSingularityImage(jobID, authConfig, builder string) (*string, error)

BuildSingularityImage builds singularity image

func ContainerAttrs

func ContainerAttrs(labels map[string]string) (string, int64, int64, time.Time)

ContainerAttrs returns original image, published port & started time

func ConvertNotebook

func ConvertNotebook(ctx context.Context, image, ipynb, to, workdir string, mounts []mount.Mount) error

ConvertNotebook converts Jupyter notebook to Python scripts

func ConvertToSingularityImage

func ConvertToSingularityImage(id, name string) (*string, error)

ConvertToSingularityImage converts a docker image to a singularity image

func DeleteImage

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

DeleteImage deletes a docker image

func DetectImageWorkDir

func DetectImageWorkDir(ctx context.Context, image string) string

DetectImageWorkDir detects image working directory

func DeviceCount

func DeviceCount(ctx context.Context) (*int64, error)

DeviceCount returns number of NVIDIA GPUS

func LogsOfDockerContainer

func LogsOfDockerContainer(ctx context.Context, cli *docker.Client, id string) (*string, error)

LogsOfDockerContainer retrieves logs from a specified container

func NvididSMI

func NvididSMI(ctx context.Context, args []string) (*string, error)

NvididSMI returns the result of nvidia-smi

func PushJobImage

func PushJobImage(ctx context.Context, imageName, authConfig string) error

PushJobImage pushes a docker image for the job

func PyVersion

func PyVersion(ctx context.Context, image, python string) string

PyVersion detect the python version inside the image

func RunAndWaitDockerContainer

func RunAndWaitDockerContainer(ctx context.Context, name string,
	config *container.Config, host *container.HostConfig,
	net *network.NetworkingConfig) (*string, error)

RunAndWaitDockerContainer run containers and wait for its stopping

func RunJupyterNotebook

func RunJupyterNotebook(ctx context.Context, originalImage, wrappedImage, workdirHost, workdir string) (*string, error)

RunJupyterNotebook runs the specified image as a jupter notebook

func RunningNotebooks

func RunningNotebooks(ctx context.Context, cli *docker.Client) ([]types.Container, error)

RunningNotebooks returns containers which was build by this app

func WrapWithJupyterNotebook

func WrapWithJupyterNotebook(ctx context.Context, id, image, builder string) (*string, error)

WrapWithJupyterNotebook builds wrapper docker images

Types

type HarborProject

type HarborProject struct {
	ID   int64  `json:"project_id"`
	Name string `json:"name"`
}

HarborProject defines the repo information

type HarborRepository

type HarborRepository struct {
	ProjectID   int64  `json:"project_id"`
	ProjectName string `json:"project_name"`
	Public      bool   `json:"project_public"`
	Name        string `json:"repository_name"`
	Tags        int64  `json:"tags_count"`
}

HarborRepository defines the repo information

func HarborRepositories

func HarborRepositories(ctx context.Context, auth types.AuthConfig) ([]*HarborRepository, error)

HarborRepositories returns harbor repos

type HarborSerchResult

type HarborSerchResult struct {
	Projects     []*HarborProject    `json:"project"`
	Repositories []*HarborRepository `json:"repository"`
}

HarborSerchResult defines the response of /api/search

type IPython

type IPython struct {
	Meta struct {
		KernelSpec struct {
			Name string `json:"name"`
			Lang string `json:"language"`
		} `json:"kernelspec"`
		Lang struct {
			Name    string `json:"name"`
			FileExt string `json:"file_extension"`
		} `json:"language_info"`
	} `json:"metadata"`
}

IPython defines a notebook

func ParseIPython

func ParseIPython(path string) *IPython

ParseIPython parses a notebook

type PackageManager

type PackageManager int

PackageManager like apt / yum

const (
	Unknown PackageManager = iota
	Apk
	Apt
	Yum
)

PackageManager values

func DetectImageContent

func DetectImageContent(ctx context.Context, image string, short bool) (PackageManager, string, string, string, string, error)

DetectImageContent detects image conditions

Jump to

Keyboard shortcuts

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