code

package
v0.0.151 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const TIMEOUT_FOR_CODE_INTEGRATION_STATUS = 90 * time.Minute

Variables

View Source
var ErrCodeIntegrationTimeout = fmt.Errorf("timeout occurred while waiting for the integration code status")
View Source
var ErrEmptyCodeSnapshot = fmt.Errorf("CodeIntegration is empty")
View Source
var LargeFileDirPatterns = []string{
	".git",
}

LargeFileDirPatterns contains directory patterns for typically large/state directories

View Source
var LargeFileExtensions = []string{

	".onnx",
	".pth", ".pt", ".ckpt", ".bin",
	".safetensors",
	".pb", ".tflite",
	".h5", ".hdf5", ".keras",
	".pkl", ".pickle", ".joblib",
	".npz", ".npy",
	".mlx", ".gguf", ".ggml",
	".trt", ".engine",

	".tar", ".tar.gz", ".tgz",

	".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".webp", ".ico",
	".psd", ".ai", ".sketch",

	".mp4", ".mov", ".avi", ".mkv", ".webm",
	".mp3", ".wav", ".flac", ".ogg", ".m4a",

	".stl", ".obj", ".fbx", ".glb", ".gltf",

	".jsonl", ".parquet", ".arrow", ".orc", ".feather",
	".db", ".sqlite", ".sqlite3",
	".zip", ".7z", ".rar",
	".dump", ".bak",
}

LargeFileExtensions contains extensions for files that are typically large and may indicate model weights, media files, datasets, or other binary data

View Source
var RequirementsFiles = []string{
	"pyproject.toml",
	"requirements.txt",
	"tensorleap_requirements.txt",
}

Functions

func AskForPythonVersion added in v0.0.92

func AskForPythonVersion(defaultVersionId string, baseImageTypes []tensorleapapi.GenericBaseImage) (string, error)

func BundleCodeIntoTempFile added in v0.0.20

func BundleCodeIntoTempFile(filesDir string, workspaceConfig *workspace.WorkspaceConfig) (close func(), tarGzFile *os.File, err error)

func CloneCodeSnapshot added in v0.0.129

func CloneCodeSnapshot(ctx context.Context, codeSnapshot *tensorleapapi.CodeSnapshot, outputDir string, specificFileName string) ([]string, error)

func CompareCodeVersion added in v0.0.23

func CompareCodeVersion(ctx context.Context, compareVersion *CodeSnapshot, tarGzFile *os.File, entryFile, secretId, pythonVersion string) (bool, error)

func CreateOrSelectBranch added in v0.0.84

func CreateOrSelectBranch(branch string, branches []string, defaultBranch string) (selectedBranch string, err error)

func DownloadCodeSnapshotArchive added in v0.0.133

func DownloadCodeSnapshotArchive(ctx context.Context, codeSnapshot *tensorleapapi.CodeSnapshot, outputPath string) error

func FetchFileFromTarGz added in v0.0.26

func FetchFileFromTarGz(blobURL string, filename string) (string, error)

func GetCodeSnapshotUploadUrl added in v0.0.129

func GetCodeSnapshotUploadUrl(ctx context.Context, projectId string) (string, error)

func GetLastEngineErrors added in v0.0.139

func GetLastEngineErrors(ctx context.Context, jobId string, count int) ([]string, error)

func GetPythonVersionFromFlag added in v0.0.92

func GetPythonVersionFromFlag(ctx context.Context, flag string) (string, error)

func GetPythonVersions added in v0.0.92

func GetPythonVersions(ctx context.Context) ([]tensorleapapi.GenericBaseImage, string, error)

func IsCodeEnded added in v0.0.129

func IsCodeEnded(codeSnapshot *CodeSnapshot) bool

func IsCodeFinished added in v0.0.129

func IsCodeFinished(codeSnapshot *CodeSnapshot) bool

func IsCodeParseFailed added in v0.0.23

func IsCodeParseFailed(codeSnapshot *CodeSnapshot) bool

func PushCode added in v0.0.23

func PushCode(ctx context.Context, tarGzFile *os.File, entryFile, secretId, pythonVersion, versionName, projectId, branch string, overwriteVersionId string) (pushed bool, current *tensorleapapi.PushCodeSnapshotResponse, err error)

func PushCodeSnapshot added in v0.0.129

func PushCodeSnapshot(
	ctx context.Context, tarGzFile io.Reader, fileSize int64,
	entryFile, secretId, pythonVersion,
	versionName, projectId, branch string,
	overwriteVersionId string,
) (*tensorleapapi.PushCodeSnapshotResponse, error)

func SelectBranch added in v0.0.84

func SelectBranch(branches []string, defaultBranch string) (selectedBranch string, err error)

func ShowReportInteractive added in v0.0.139

func ShowReportInteractive(report *CodeSnapshotParserErr) error

ShowReportInteractive displays the report in an interactive tabbed interface

func SyncBranchFromFlagAndConfig added in v0.0.84

func SyncBranchFromFlagAndConfig(flagBranch string, workspaceConfig *workspace.WorkspaceConfig) (string, error)

func SyncPythonVersionFromFlagAndConfig added in v0.0.92

func SyncPythonVersionFromFlagAndConfig(ctx context.Context, flag string, workspaceConfig *workspace.WorkspaceConfig) (string, error)

func WaitForCodeIntegrationStatus added in v0.0.22

func WaitForCodeIntegrationStatus(ctx context.Context, projectId, codeSnapshotId string) (bool, error)

Types

type BinderError added in v0.0.139

type BinderError struct {
	// contains filtered or unexported fields
}

type CodeSnapshot added in v0.0.129

type CodeSnapshot = tensorleapapi.CodeSnapshot

func GetCodeSnapshot added in v0.0.129

func GetCodeSnapshot(ctx context.Context, projectId, id string) (*CodeSnapshot, error)

type CodeSnapshotParserErr added in v0.0.139

type CodeSnapshotParserErr struct {
	TopLogs []string
	// contains filtered or unexported fields
}

func CollectErrorsOnCodeParseFailed added in v0.0.139

func CollectErrorsOnCodeParseFailed(ctx context.Context, jobId string, codeSnapshot *tensorleapapi.CodeSnapshot, commandStartTime time.Time) (*CodeSnapshotParserErr, error)

func (*CodeSnapshotParserErr) Init added in v0.0.139

func (r *CodeSnapshotParserErr) Init() tea.Cmd

func (*CodeSnapshotParserErr) ToReportPages added in v0.0.139

ToReportPages converts a CodeSnapshotParserErr to an interactive ReportPages for displaying in a tabbed interface

func (*CodeSnapshotParserErr) Update added in v0.0.139

func (r *CodeSnapshotParserErr) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*CodeSnapshotParserErr) View added in v0.0.139

func (r *CodeSnapshotParserErr) View() string

type CodeSnapshotParserErrs added in v0.0.139

type CodeSnapshotParserErrs struct {
	// contains filtered or unexported fields
}

func CollectCodeSnapshotParserErr added in v0.0.139

func CollectCodeSnapshotParserErr(civ *CodeSnapshot) *CodeSnapshotParserErrs

func (*CodeSnapshotParserErrs) View added in v0.0.139

func (r *CodeSnapshotParserErrs) View() string

type EmptyPageContent added in v0.0.139

type EmptyPageContent struct {
	// contains filtered or unexported fields
}

--------------------------- Empty Page Content ---------------------------

func (*EmptyPageContent) Init added in v0.0.139

func (e *EmptyPageContent) Init() tea.Cmd

func (*EmptyPageContent) Update added in v0.0.139

func (e *EmptyPageContent) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*EmptyPageContent) View added in v0.0.139

func (e *EmptyPageContent) View() string

type LargeFilesResult added in v0.0.133

type LargeFilesResult struct {
	TotalSize       int64               // Total size of all large files in bytes
	SizePerPattern  map[string]int64    // Size sum per glob pattern (e.g., "*.png" -> 1024)
	MatchedPatterns map[string][]string // Map of glob pattern (e.g., "*.png", ".git/**") -> list of matching file paths
	RemainingFiles  []string            // Files that don't match any large file pattern
}

LargeFilesResult holds the result of scanning for large files

func SumLargeFilesSize added in v0.0.133

func SumLargeFilesSize(filesDir string, filePaths []string) (*LargeFilesResult, error)

SumLargeFilesSize calculates the total size of files that match large file extensions or are inside state directories like .git Returns: - LargeFilesResult containing total size, matched patterns with their files, and remaining files - error if any

type ParserErrorsPageContent added in v0.0.139

type ParserErrorsPageContent struct {
	// contains filtered or unexported fields
}

--------------------------- Parser Errors Page Content ---------------------------

func (*ParserErrorsPageContent) Init added in v0.0.139

func (p *ParserErrorsPageContent) Init() tea.Cmd

func (*ParserErrorsPageContent) Update added in v0.0.139

func (p *ParserErrorsPageContent) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ParserErrorsPageContent) View added in v0.0.139

func (p *ParserErrorsPageContent) View() string

Jump to

Keyboard shortcuts

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