Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/cmd/lib_config_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func allConfigPaths(root string) []string {

func appNameFromConfig() (string, error) {
appRoot := mustAppRoot()
return userconfig.ReadAppName(filepath.Join(appRoot, "app.yaml"))
return userconfig.ReadAppName(filepath.Join(appRoot, "app.yaml"), "app.yaml")
}

func AppNameFromFlagOrConfig() (string, error) {
Expand Down
18 changes: 12 additions & 6 deletions pkg/api/context/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ type Model struct {

type TrainingDataset struct {
*ComputedResourceFields
Name string `json:"name"`
ModelName string `json:"model_name"`
TrainKey string `json:"train_key"`
EvalKey string `json:"eval_key"`
MetadataKey string `json:"metadata_key"`
Name string `json:"name"`
ModelName string `json:"model_name"`
TrainKey string `json:"train_key"`
EvalKey string `json:"eval_key"`
MetadataKey string `json:"metadata_key"`
FilePath string `json:"file_path"`
Embed *userconfig.Embed `json:"embed"`
}

func (trainingDataset *TrainingDataset) GetName() string {
Expand All @@ -53,7 +55,11 @@ func (trainingDataset *TrainingDataset) GetResourceType() resource.Type {
}

func (trainingDataset *TrainingDataset) GetFilePath() string {
return ""
return trainingDataset.FilePath
}

func (trainingDataset *TrainingDataset) GetEmbed() *userconfig.Embed {
return trainingDataset.Embed
}

func (models Models) OneByID(id string) *Model {
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/context/python_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package context

import (
"github.com/cortexlabs/cortex/pkg/api/resource"
"github.com/cortexlabs/cortex/pkg/api/userconfig"
)

type PythonPackages map[string]*PythonPackage
Expand All @@ -40,3 +41,7 @@ func (pythonPackage *PythonPackage) GetResourceType() resource.Type {
func (pythonPackage *PythonPackage) GetFilePath() string {
return ""
}

func (pythonPackage *PythonPackage) GetEmbed() *userconfig.Embed {
return nil
}
18 changes: 18 additions & 0 deletions pkg/api/resource/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
ErrNameNotFound
ErrNameOrTypeNotFound
ErrInvalidType
ErrTemplateInTemplate
ErrEmbedInTemplate
)

var (
Expand All @@ -41,6 +43,8 @@ var (
"err_name_not_found",
"err_name_or_type_not_found",
"err_invalid_type",
"err_template_in_template",
"err_embed_in_template",
}
)

Expand Down Expand Up @@ -121,3 +125,17 @@ func ErrorUnknownKind(name string) error {
message: fmt.Sprintf("unknown kind %s", s.UserStr(name)),
}
}

func ErrorTemplateInTemplate() error {
return ResourceError{
Kind: ErrTemplateInTemplate,
message: "templates cannot be defined inside of templates",
}
}

func ErrorEmbedInTemplate() error {
return ResourceError{
Kind: ErrEmbedInTemplate,
message: "embeds cannot be defined inside of templates",
}
}
5 changes: 5 additions & 0 deletions pkg/api/userconfig/aggregates.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Aggregate struct {
Compute *SparkCompute `json:"compute" yaml:"compute"`
Tags Tags `json:"tags" yaml:"tags"`
FilePath string `json:"file_path" yaml:"-"`
Embed *Embed `json:"embed" yaml:"-"`
}

var aggregateValidation = &cr.StructValidation{
Expand Down Expand Up @@ -81,6 +82,10 @@ func (aggregate *Aggregate) GetFilePath() string {
return aggregate.FilePath
}

func (aggregate *Aggregate) GetEmbed() *Embed {
return aggregate.Embed
}

func (aggregates Aggregates) Names() []string {
names := make([]string, len(aggregates))
for i, aggregate := range aggregates {
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/userconfig/aggregators.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Aggregator struct {
OutputType interface{} `json:"output_type" yaml:"output_type"`
Path string `json:"path" yaml:"path"`
FilePath string `json:"file_path" yaml:"-"`
Embed *Embed `json:"embed" yaml:"-"`
}

var aggregatorValidation = &cr.StructValidation{
Expand Down Expand Up @@ -96,6 +97,10 @@ func (aggregator *Aggregator) GetFilePath() string {
return aggregator.FilePath
}

func (aggregator *Aggregator) GetEmbed() *Embed {
return aggregator.Embed
}

func (aggregators Aggregators) Names() []string {
names := make([]string, len(aggregators))
for i, aggregator := range aggregators {
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/userconfig/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type API struct {
Compute *APICompute `json:"compute" yaml:"compute"`
Tags Tags `json:"tags" yaml:"tags"`
FilePath string `json:"file_path" yaml:"-"`
Embed *Embed `json:"embed" yaml:"-"`
}

var apiValidation = &cr.StructValidation{
Expand Down Expand Up @@ -79,6 +80,10 @@ func (api *API) GetFilePath() string {
return api.FilePath
}

func (api *API) GetEmbed() *Embed {
return api.Embed
}

func (apis APIs) Names() []string {
names := make([]string, len(apis))
for i, api := range apis {
Expand Down
9 changes: 0 additions & 9 deletions pkg/api/userconfig/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package userconfig

import (
"github.com/cortexlabs/cortex/pkg/api/resource"
cr "github.com/cortexlabs/cortex/pkg/utils/configreader"
)

Expand All @@ -40,14 +39,6 @@ var appValidation = &cr.StructValidation{
},
}

func (app *App) GetName() string {
return app.Name
}

func (app *App) GetResourceType() resource.Type {
return resource.AppType
}

func (app *App) Validate() error {
return nil
}
Loading