batchinferenceutils

package
v0.0.0-...-58c3220 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StepSyncData       = "sync-data"
	StepSyncModel      = "sync-model"
	StepValidateInput  = "validate-input"
	StepLogInput       = "log-input"
	StepUserContainer  = "user-container"
	StepValidateOutput = "validate-output"
	StepLogOutput      = "log-output"
	StepSyncOutput     = "sync-output"
)

Step names

Variables

View Source
var (
	XDGConfigHomeEnv = corev1.EnvVar{
		Name:  "XDG_CONFIG_HOME",
		Value: XDGConfigHome,
	}
	ToolsConfigPathEnv = corev1.EnvVar{
		Name:  "ODAHU_TOOLS_CONFIG",
		Value: toolsConfigVM.MountPath,
	}
	// Where we copy model in case of remote model registry (if embedded then path is provided by user)
	DefaultOdahuModelPathEnv = corev1.EnvVar{
		Name:  odahuModelPathEnvName,
		Value: odahuModelPath,
	}
	OdahuInputPathEnv = corev1.EnvVar{
		Name:  "ODAHU_INPUT_PATH",
		Value: odahuInputPath,
	}
	OdahuOutputPathEnv = corev1.EnvVar{
		Name:  "ODAHU_OUTPUT_PATH",
		Value: odahuRawOutputPath,
	}
)

ENVs

View Source
var (
	XDGConfigHome = path.Join(workspacePath, "config")
)

paths

Functions

func BatchJobToTaskSpec

func BatchJobToTaskSpec(job *v1alpha1.BatchInferenceJob,
	connAPI controller_types.ConnGetter,
	gpuResourceName string, rcloneImage string,
	toolsSecret string,
	toolsImage string,
) (ts *tektonv1beta1.TaskSpec, err error)

BatchJobToTaskSpec generate tektoncd TaskSpec based on v1alpha1.BatchInferenceJob

func DiscoverNameVersion

func DiscoverNameVersion(
	connName string, modelPath string,
	connType v1alpha1.ConnectionType, connAPI controller_types.ConnGetter) (name string, version string, err error)

func GetBucketNamePath

func GetBucketNamePath(connName string, path string, connAPI controller_types.ConnGetter) (
	bucketName string, actualPath string, err error)

func GetConfigureRCloneStep

func GetConfigureRCloneStep(image string, res corev1.ResourceRequirements, conns ...string) tektonv1beta1.Step

GetConfigureRCloneStep return step that configures environment (rclone config) for syncing data and model using ODAHU connections

func GetLogInputStep

func GetLogInputStep(image string, requestID string, res corev1.ResourceRequirements,
	modelName string, modelVersion string) tektonv1beta1.Step

GetLogInputStep return step that logs model input to feedback storage (catch requests)

func GetLogOutputStep

func GetLogOutputStep(image string, requestID string, res corev1.ResourceRequirements,
	modelName string, modelVersion string) tektonv1beta1.Step

GetLogOutputStep return step that logs model output to feedback storage (catch responses)

func GetModelSyncSteps

func GetModelSyncSteps(
	job *v1alpha1.BatchInferenceJob,
	res corev1.ResourceRequirements,
	odahuToolsImage string,
	connType v1alpha1.ConnectionType,
) (steps []tektonv1beta1.Step, err error)

GetModelSyncSteps return steps that a specific for certain model synchronization case depending on v1alpha1.ModelSource (remote or local) and connection type

func GetObjectStorageModelSyncStep

func GetObjectStorageModelSyncStep(image string, connName string,
	modelPath string, res corev1.ResourceRequirements) tektonv1beta1.Step

GetSyncModelStep return step that syncs model from s3/gcs/azureblob bucket to workspace

func GetSyncDataStep

func GetSyncDataStep(
	rcloneImage string,
	rcloneConfigName string,
	bucketName string,
	inputPath string,
	res corev1.ResourceRequirements,
) tektonv1beta1.Step

GetSyncDataStep return step that syncs input data to pre-stage directory inside Pod where input will be validated and copied to user container's input directory

func GetSyncOutputStep

func GetSyncOutputStep(
	rcloneImage string,
	rcloneConfigName string,
	bucketName string,
	remoteOutputPath string,
	res corev1.ResourceRequirements,
) tektonv1beta1.Step

GetSyncOutputStep return step that syncs output data to bucket

func GetUserContainer

func GetUserContainer(
	image string, command []string, args []string,
	res corev1.ResourceRequirements, odahuModelPathEnv corev1.EnvVar) tektonv1beta1.Step

GetUserContainer return step that execute user defined container for inference

func GetValidateInputStep

func GetValidateInputStep(image string, res corev1.ResourceRequirements) tektonv1beta1.Step

GetValidateInputStep return step that validates raw input according kubeflow prediction api (version 2) InferenceRequest object. Only validated files are copied to user container for inference.

func GetValidateOutputStep

func GetValidateOutputStep(image string, res corev1.ResourceRequirements) tektonv1beta1.Step

GetValidateOutputStep return step that validates raw output according kubeflow prediction api (version 2) InferenceResponse object. Only validated files are copied from user container results to destination

Types

This section is empty.

Jump to

Keyboard shortcuts

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