Documentation ¶
Overview ¶
TODO: this code desperately needs love and refactoring
Index ¶
- Constants
- func MakeArtifactNameSafe(name string) string
- type ArtifactInfoForJob
- type ArtifactSource
- type Config
- type ConfigDict
- type ConfigPath
- type GitInfo
- type GitSource
- type ImageSource
- type JobBuilder
- func (j *JobBuilder) Build(output map[string]interface{}) (artifact *service.ArtifactRecord, rerr error)
- func (j *JobBuilder) GetSourceType(metadata RunMetadata) (*SourceType, error)
- func (j *JobBuilder) HandleJobInputRequest(request *service.JobInputRequest)
- func (j *JobBuilder) HandleLogArtifactResult(response *service.LogArtifactResponse, record *service.ArtifactRecord)
- func (j *JobBuilder) HandlePathsAboveRoot(programRelpath, root string) (string, error)
- func (j *JobBuilder) HandleUseArtifactRecord(record *service.Record)
- func (j *JobBuilder) SetRunConfig(config runconfig.RunConfig)
- type JobSourceMetadata
- type LogLevel
- type PartialJobSource
- type PathMap
- type RunMetadata
- type Source
- type SourceType
Constants ¶
const ( RepoSourceType SourceType = "repo" ArtifactSourceType SourceType = "artifact" ImageSourceType SourceType = "image" WandbConfigKey string = "@wandb.config" )
const DIFF_FNAME = "diff.patch"
const FROZEN_REQUIREMENTS_FNAME = "requirements.frozen.txt"
const REQUIREMENTS_FNAME = "requirements.txt"
const WANDB_METADATA_FNAME = "wandb-metadata.json"
Variables ¶
This section is empty.
Functions ¶
func MakeArtifactNameSafe ¶
Types ¶
type ArtifactInfoForJob ¶
type ArtifactSource ¶
type ArtifactSource struct { Artifact string `json:"artifact"` Entrypoint []string `json:"entrypoint"` Notebook bool `json:"notebook"` BuildContext *string `json:"build_context,omitempty"` Dockerfile *string `json:"dockerfile,omitempty"` }
Define the ArtifactSource struct that implements the Source interface.
func (ArtifactSource) GetSourceArtifact ¶
func (a ArtifactSource) GetSourceArtifact() *string
func (ArtifactSource) GetSourceGit ¶
func (a ArtifactSource) GetSourceGit() *GitInfo
func (ArtifactSource) GetSourceImage ¶
func (a ArtifactSource) GetSourceImage() *string
func (ArtifactSource) GetSourceType ¶
func (a ArtifactSource) GetSourceType() SourceType
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a wrapper around a configuration tree that provides helpful methods.
In launch, we use this to filter various configuration trees based on include and exclude paths. This allows users to specify which parts of the configuration tree they want to include in job inputs.
func NewConfigFrom ¶
func NewConfigFrom(tree ConfigDict) *Config
type ConfigDict ¶
type ConfigDict = map[string]interface{}
ConfigDict is the Type representing a configuration tree.
type ConfigPath ¶
type ConfigPath []string
ConfigPath is a key path determining a node in the run config tree.
type GitSource ¶
type GitSource struct { Git GitInfo `json:"git"` Entrypoint []string `json:"entrypoint"` Notebook bool `json:"notebook"` BuildContext *string `json:"build_context,omitempty"` Dockerfile *string `json:"dockerfile,omitempty"` }
Define the GitSource struct that implements the Source interface.
func (GitSource) GetSourceArtifact ¶
func (GitSource) GetSourceGit ¶
func (GitSource) GetSourceImage ¶
func (GitSource) GetSourceType ¶
func (g GitSource) GetSourceType() SourceType
type ImageSource ¶
type ImageSource struct {
Image string `json:"image"`
}
Define the ImageSource struct that implements the Source interface.
func (ImageSource) GetSourceArtifact ¶
func (i ImageSource) GetSourceArtifact() *string
func (ImageSource) GetSourceGit ¶
func (i ImageSource) GetSourceGit() *GitInfo
func (ImageSource) GetSourceImage ¶
func (i ImageSource) GetSourceImage() *string
func (ImageSource) GetSourceType ¶
func (i ImageSource) GetSourceType() SourceType
type JobBuilder ¶
type JobBuilder struct { PartialJobSource *PartialJobSource Disable bool RunCodeArtifact *ArtifactInfoForJob // contains filtered or unexported fields }
func NewJobBuilder ¶
func NewJobBuilder(settings *service.Settings, logger *observability.CoreLogger, verbose bool) *JobBuilder
func (*JobBuilder) Build ¶
func (j *JobBuilder) Build( output map[string]interface{}, ) (artifact *service.ArtifactRecord, rerr error)
func (*JobBuilder) GetSourceType ¶
func (j *JobBuilder) GetSourceType(metadata RunMetadata) (*SourceType, error)
func (*JobBuilder) HandleJobInputRequest ¶
func (j *JobBuilder) HandleJobInputRequest(request *service.JobInputRequest)
Configure a new job input for the job builder.
This method is called when a user declares a new variable input for their job. The request specifies the source of the input (a file or the run config) and sets of keys in that config to include or exclude from the input. The key sets are expressed as path prefixes in the config.
func (*JobBuilder) HandleLogArtifactResult ¶
func (j *JobBuilder) HandleLogArtifactResult(response *service.LogArtifactResponse, record *service.ArtifactRecord)
func (*JobBuilder) HandlePathsAboveRoot ¶
func (j *JobBuilder) HandlePathsAboveRoot(programRelpath, root string) (string, error)
func (*JobBuilder) HandleUseArtifactRecord ¶
func (j *JobBuilder) HandleUseArtifactRecord(record *service.Record)
func (*JobBuilder) SetRunConfig ¶
func (j *JobBuilder) SetRunConfig(config runconfig.RunConfig)
type JobSourceMetadata ¶
type JobSourceMetadata struct { Version string `json:"_version"` Source Source `json:"source"` SourceType SourceType `json:"source_type"` InputTypes data_types.TypeRepresentation `json:"input_types"` OutputTypes data_types.TypeRepresentation `json:"output_types"` Runtime *string `json:"runtime,omitempty"` Partial *string `json:"_partial,omitempty"` }
Define the JobSourceMetadata struct.
type PartialJobSource ¶
type PartialJobSource struct { JobName string `json:"job_name"` JobSourceInfo JobSourceMetadata `json:"job_source_info"` }
type PathMap ¶
type PathMap map[*ConfigPath]interface{}
PathMap is a flat representation of the configuration tree, where each path is a list of keys and the value is the value at that path in the tree.
Note that this is a map of pointers to paths, not paths themselves. If you want to check if a path is in the map, you need to use the address of the path or iterate over the map and compare the paths.
type RunMetadata ¶
type RunMetadata struct { SourceType *SourceType `json:"source_type"` Partial *string `json:"_partial"` Git *GitInfo `json:"git"` Root *string `json:"root"` Docker *string `json:"docker"` Program *string `json:"program"` CodePathLocal *string `json:"codePathLocal"` CodePath *string `json:"codePath"` Entrypoint *[]string `json:"entrypoint"` Python *string `json:"python"` }
type Source ¶
type Source interface { GetSourceType() SourceType GetSourceGit() *GitInfo GetSourceArtifact() *string GetSourceImage() *string }
Define the Source interface with a common method.
type SourceType ¶
type SourceType string