dvc run with -M flag doesn't accept directories as metrics whereas dvc run with -m flag does. This behavior should be unified.
DVC version:
Additional Information :
Steps to reproduce
-
Initialize git and dvc
-
Create evaluate.py:
import argparse
import os
import json
parser = argparse.ArgumentParser()
parser.add_argument("--metrics_dir", required=True)
args = parser.parse_args()
metrics_dir = args.metrics_dir
if not os.path.exists(metrics_dir):
os.makedirs(metrics_dir)
with open(os.path.join(metrics_dir, "metrics1.json"), "w") as f:
json.dump({"acc": 1.0}, f)
with open(os.path.join(metrics_dir, "metric2.json"), "w") as f:
json.dump({"acc": 0.5}, f)
- Create new stage with directory as cached metrics output:
$ dvc run -f metrics_cached.dvc -d evaluate.py -m metrics_cached python3 evaluate.py --metrics_dir metrics_cached
Running command:
python3 evaluate.py --metrics_dir metrics_cached
To track the changes with git, run:
git add metrics_cached.dvc .gitignore
- Create new stage with directory as not cached metrics output:
$ dvc run -f metrics_not_cached.dvc -d evaluate.py -M metrics_not_cached python3 evaluate.py --metrics_dir metrics_not_cached
Running command:
python3 evaluate.py --metrics_dir metrics_not_cached
ERROR: failed to run command - directory 'metrics_not_cached' cannot be used as metrics.
Both commands should either accept directories as metrics either discard them
dvc runwith-Mflag doesn't accept directories as metrics whereasdvc runwith-mflag does. This behavior should be unified.DVC version:
Additional Information :
Steps to reproduce
Initialize git and dvc
Create
evaluate.py:Both commands should either accept directories as metrics either discard them