Skip to content

Commit 71416e4

Browse files
updated the logs to be inline and removed storing the warnings
1 parent cb93677 commit 71416e4

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11

22
>>> [CLI] workspace export-dir /test-dir [TEST_TMP_DIR]/export
33
Exporting files from /test-dir
4-
5-
Warnings:
6-
- /test-dir/file.py (skipped; file too large)
7-
4+
/test-dir/file.py (skipped; file too large)
85
Export complete
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11

22
>>> [CLI] workspace export-dir /test-dir [TEST_TMP_DIR]/export
33
Exporting files from /test-dir
4-
5-
Warnings:
6-
- /test-dir/experiment (skipped; cannot export MLFLOW_EXPERIMENT)
7-
4+
/test-dir/experiment (skipped; cannot export MLFLOW_EXPERIMENT)
85
Export complete

cmd/workspace/workspace/export_dir.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type exportDirOptions struct {
2525
sourceDir string
2626
targetDir string
2727
overwrite bool
28-
warnings []string
2928
}
3029

3130
// isFileSizeError checks if the error is due to file size limits.
@@ -101,7 +100,7 @@ func (opts *exportDirOptions) callback(ctx context.Context, workspaceFiler filer
101100

102101
// Skip non-exportable objects (e.g., MLFLOW_EXPERIMENT, LIBRARY)
103102
if isNonExportable(objectInfo.ObjectType) {
104-
opts.warnings = append(opts.warnings, fmt.Sprintf("%s (skipped; cannot export %s)", sourcePath, objectInfo.ObjectType))
103+
cmdio.LogString(ctx, fmt.Sprintf("%s (skipped; cannot export %s)", sourcePath, objectInfo.ObjectType))
105104
return nil
106105
}
107106

@@ -120,7 +119,7 @@ func (opts *exportDirOptions) callback(ctx context.Context, workspaceFiler filer
120119
if err != nil {
121120
// Check if this is a file size limit error
122121
if isFileSizeError(err) {
123-
opts.warnings = append(opts.warnings, sourcePath+" (skipped; file too large)")
122+
cmdio.LogString(ctx, sourcePath+" (skipped; file too large)")
124123
return nil
125124
}
126125
return err
@@ -166,7 +165,6 @@ func newExportDir() *cobra.Command {
166165
w := cmdctx.WorkspaceClient(ctx)
167166
opts.sourceDir = args[0]
168167
opts.targetDir = args[1]
169-
opts.warnings = []string{}
170168

171169
// Initialize a filer and a file system on the source directory
172170
workspaceFiler, err := filer.NewWorkspaceFilesClient(w, opts.sourceDir)
@@ -185,16 +183,6 @@ func newExportDir() *cobra.Command {
185183
return err
186184
}
187185

188-
// Print all warnings at the end if any were collected
189-
if len(opts.warnings) > 0 {
190-
cmdio.LogString(ctx, "")
191-
cmdio.LogString(ctx, "Warnings:")
192-
for _, warning := range opts.warnings {
193-
cmdio.LogString(ctx, " - "+warning)
194-
}
195-
cmdio.LogString(ctx, "")
196-
}
197-
198186
return cmdio.RenderWithTemplate(ctx, newExportCompletedEvent(opts.targetDir), "", "Export complete\n")
199187
}
200188

0 commit comments

Comments
 (0)