Hi, would anyone be able to advise what I am doing...
# ask-community
h
Hi, would anyone be able to advise what I am doing wrong here?
Copy code
from dagster import (
    InMemoryIOManager,
    asset,
    materialize,
)


@asset
def asset_a():
    return


@asset()
def asset_b(asset_a):
    return


shared_io_manager = InMemoryIOManager()

materialize(
    assets=[asset_a, asset_b],
    resources={"io_manager": shared_io_manager},
    selection=[asset_a],
)

materialize(
    assets=[asset_a, asset_b],
    resources={"io_manager": shared_io_manager},
    selection=[asset_b],
)
dagster._core.errors.DagsterInvariantViolationError: Attempting to access run_id, but it was not provided when constructing the OutputContext
🤖 1
j
Hey @Harry James I think the intricacy here is that a completely fresh
InMemoryIOManager
is created for each materialization. This means that any historical information about previous runs is lost. I suggest trying the
FileSystemIOManager
instead! Otherwise your code snippet looks good to me
h
@jamie Thank you for getting back to me! I'll give the FileSystemIOManager a go. Perhaps it relates to this https://github.com/dagster-io/dagster/issues/6834
j
yeah - for what it’s worth i’ve always considered the in mem io manager as purposefully losing the data between runs - it’s useful for running unit tests so you dont need to worry about data cleanup etc