Hello, Sorry for the beginner question but I could...
# ask-community
c
Hello, Sorry for the beginner question but I couldn't find this in the docs. I have an op that returns two outputs. However the log shows that the second output just overwrites the first output on disk, so in this example both "model" and "metrics" point to to the same "metrics" file on disk as "model" is overwritten. Any ideas?
Copy code
@op(out={"model": Out(), "metrics": Out()})
def train(dm):

    res = sc.run_training(dm)
    model = res.get_model("logreg")
    metrics = res.get_model_metrics("logreg")

    return (
        Output(model, output_name="model"),
        Output(str(metrics), output_name="metrics"),
    )
🤖 1
z
hmm have you tried yielding the outputs individually? I'm not sure if that's still required in some situations, but maybe try something like
Copy code
@op(out={"model": Out(), "metrics": Out()})
def train(dm):

    res = sc.run_training(dm)
    model = res.get_model("logreg")
    metrics = res.get_model_metrics("logreg")

    yield Output(model, output_name="model"),
    yield Output(str(metrics), output_name="metrics")
c
Thanks for the reply. I've tried a few iterations, including yield instead of return, and returning as a tuple or not. In the log it shows both items are returned, but the path is identical for each
Copy code
Handled output "metrics" using IO manager "io_manager" path /workspaces/dagster-test/storage/train_results_brw
Handled output "model" using IO manager "io_manager" path /workspaces/dagster-test/storage/train_results_brw
I wonder if this is the issue, that both outputs are saved to the same path?
s
Hmm, I would expect this not to write to the same file. Are you using the default IO manager? Where is the string "results_brw" coming from?
c
@sandy Thanks for the reply! I forgot I still had this up. The issue was resolved by fixing the code in a AssetsDeginition.from_op call