@@ -23,6 +23,7 @@ import (
2323 "strings"
2424 "time"
2525
26+ "github.com/cortexlabs/cortex/cli/types/flags"
2627 "github.com/cortexlabs/cortex/pkg/lib/archive"
2728 "github.com/cortexlabs/cortex/pkg/lib/aws"
2829 "github.com/cortexlabs/cortex/pkg/lib/cron"
@@ -75,7 +76,7 @@ func CacheModels(apiSpec *spec.API, awsClient *aws.Client) ([]*spec.LocalModelCa
7576 }
7677
7778 if uncachedModelCount > 0 {
78- fmt . Println ("" ) // Newline to group all of the model information
79+ localPrintln ("" ) // Newline to group all of the model information
7980 }
8081
8182 return localModelCaches , nil
@@ -134,13 +135,13 @@ func cacheModel(modelPath string, localModelCache spec.LocalModelCache, awsClien
134135 return err
135136 }
136137 } else if strings .HasSuffix (modelPath , ".onnx" ) {
137- fmt . Println (fmt .Sprintf ("○ caching model %s ..." , modelPath ))
138+ localPrintln (fmt .Sprintf ("○ caching model %s ..." , modelPath ))
138139 err := files .CopyFileOverwrite (modelPath , filepath .Join (modelDir , filepath .Base (modelPath )))
139140 if err != nil {
140141 return err
141142 }
142143 } else {
143- fmt . Println (fmt .Sprintf ("○ caching model %s ..." , modelPath ))
144+ localPrintln (fmt .Sprintf ("○ caching model %s ..." , modelPath ))
144145 tfModelVersion := filepath .Base (modelPath )
145146 err := files .CopyDirOverwrite (strings .TrimSuffix (modelPath , "/" ), s .EnsureSuffix (filepath .Join (modelDir , tfModelVersion ), "/" ))
146147 if err != nil {
@@ -196,10 +197,12 @@ func DeleteCachedModelsByID(modelIDs []string) error {
196197}
197198
198199func downloadModel (modelPath string , modelDir string , awsClientForBucket * aws.Client ) error {
199- fmt .Printf ("○ downloading model %s " , modelPath )
200- defer fmt .Print (" ✓\n " )
201- dotCron := cron .Run (print .Dot , nil , 2 * time .Second )
202- defer dotCron .Cancel ()
200+ localPrintf ("○ downloading model %s " , modelPath )
201+ defer localPrint (" ✓\n " )
202+ if OutputType != flags .JSONOutputType {
203+ dotCron := cron .Run (print .Dot , nil , 2 * time .Second )
204+ defer dotCron .Cancel ()
205+ }
203206
204207 bucket , prefix , err := aws .SplitS3Path (modelPath )
205208 if err != nil {
@@ -234,7 +237,7 @@ func downloadModel(modelPath string, modelDir string, awsClientForBucket *aws.Cl
234237}
235238
236239func unzipAndValidate (originalModelPath string , zipFile string , destPath string ) error {
237- fmt . Println (fmt .Sprintf ("○ unzipping model %s ..." , originalModelPath ))
240+ localPrintln (fmt .Sprintf ("○ unzipping model %s ..." , originalModelPath ))
238241 tmpDir := filepath .Join (filepath .Dir (destPath ), filepath .Base (destPath )+ "-tmp" )
239242 err := files .CreateDir (tmpDir )
240243 if err != nil {
0 commit comments