Skip to content

Commit

Permalink
better error message with dump (Netflix#2130)
Browse files Browse the repository at this point in the history
* better error message with dump

* only print on final failure
  • Loading branch information
madhur-ob authored Nov 6, 2024
1 parent 4dc910a commit 65fd888
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions metaflow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,31 @@ def dump(obj, input_path, private=None, max_value_size=None, include=None, file=
else:
ds_list = list(datastore_set) # get all tasks

tasks_processed = False
for ds in ds_list:
echo(
"Dumping output of run_id=*{run_id}* "
"step=*{step}* task_id=*{task_id}*".format(
run_id=ds.run_id, step=ds.step_name, task_id=ds.task_id
),
fg="magenta",
)

if file is None:
echo_always(
ds.format(**kwargs), highlight="green", highlight_bold=False, err=False
if ds is not None:
tasks_processed = True
echo(
"Dumping output of run_id=*{run_id}* "
"step=*{step}* task_id=*{task_id}*".format(
run_id=ds.run_id, step=ds.step_name, task_id=ds.task_id
),
fg="magenta",
)
else:
output[ds.pathspec] = ds.to_dict(**kwargs)

if file is None:
echo_always(
ds.format(**kwargs),
highlight="green",
highlight_bold=False,
err=False,
)
else:
output[ds.pathspec] = ds.to_dict(**kwargs)

if not tasks_processed:
echo(f"No task(s) found for pathspec {input_path}", fg="red")
return

if file is not None:
with open(file, "wb") as f:
Expand Down

0 comments on commit 65fd888

Please sign in to comment.