Skip to content

Commit a4bac6e

Browse files
authored
Add a config option to enable fast builds (#2222)
* This enables fast builds throughout the build without specifying —x-fast in every command
1 parent 38d34ec commit a4bac6e

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

pkg/cli/build.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ func buildCommand(cmd *cobra.Command, args []string) error {
5757
if err != nil {
5858
return err
5959
}
60+
if cfg.Build.Fast {
61+
buildFast = cfg.Build.Fast
62+
}
6063

6164
imageName := cfg.Image
6265
if buildTag != "" {

pkg/cli/predict.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ func cmdPredict(cmd *cobra.Command, args []string) error {
7676
if err != nil {
7777
return err
7878
}
79+
if cfg.Build.Fast {
80+
buildFast = cfg.Build.Fast
81+
}
7982

8083
if imageName, err = image.BuildBase(cfg, projectDir, buildUseCudaBaseImage, DetermineUseCogBaseImage(cmd), buildProgressOutput); err != nil {
8184
return err
@@ -117,6 +120,9 @@ func cmdPredict(cmd *cobra.Command, args []string) error {
117120
if gpus == "" && conf.Build.GPU {
118121
gpus = "all"
119122
}
123+
if conf.Build.Fast {
124+
buildFast = conf.Build.Fast
125+
}
120126
}
121127

122128
console.Info("")

pkg/cli/push.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ func push(cmd *cobra.Command, args []string) error {
4545
if err != nil {
4646
return err
4747
}
48+
if cfg.Build.Fast {
49+
buildFast = cfg.Build.Fast
50+
}
4851

4952
imageName := cfg.Image
5053
if len(args) > 0 {

pkg/cli/train.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func cmdTrain(cmd *cobra.Command, args []string) error {
6363
if err != nil {
6464
return err
6565
}
66+
if cfg.Build.Fast {
67+
buildFast = cfg.Build.Fast
68+
}
6669

6770
if imageName, err = image.BuildBase(cfg, projectDir, buildUseCudaBaseImage, DetermineUseCogBaseImage(cmd), buildProgressOutput); err != nil {
6871
return err
@@ -98,6 +101,9 @@ func cmdTrain(cmd *cobra.Command, args []string) error {
98101
if gpus == "" && conf.Build.GPU {
99102
gpus = "all"
100103
}
104+
if conf.Build.Fast {
105+
buildFast = conf.Build.Fast
106+
}
101107
}
102108

103109
console.Info("")

pkg/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type Build struct {
5555
PreInstall []string `json:"pre_install,omitempty" yaml:"pre_install"` // Deprecated, but included for backwards compatibility
5656
CUDA string `json:"cuda,omitempty" yaml:"cuda"`
5757
CuDNN string `json:"cudnn,omitempty" yaml:"cudnn"`
58+
Fast bool `json:"fast,omitempty" yaml:"fast"`
5859

5960
pythonRequirementsContent []string
6061
}

0 commit comments

Comments
 (0)