Hello, are there any plans to support running Dagi...
# ask-community
c
Hello, are there any plans to support running Dagit in a bazel environment? Is this already possible? My assets have a combination of dependencies in python and C++ and bazel makes this really clean to manage. It's been a pain to keep the Dagit dependencies explicitly separated and I've gotten to the point where I can't keep it in sync with our bazel-managed environment.
z
I've done it with pants, so I would assume it can be done in bazel. I think you'd just make Dagit its own artifact that you build off some dependencies target - at least that's how I'd do it in pants
s
Hey Chaitya - alas, this isn't currently on our roadmap
c
I'm having a bit of trouble getting dagster-postgres to play friendly here. It seems like the dependency isn't wired up correctly on the dagit side:
Copy code
Traceback (most recent call last):
  File "/home/user/.cache/bazel/_bazel_chaitya/933c2f549343e099e3a6911b282cb71c/execroot/av/bazel-out/linux-x86_64-haswell-opt/bin/external/site-packages_pypi__38__dagit_1_3_3/bin-dagit.runfiles/site-packages_pypi__38__dagster_1_3_3/dagster/_serdes/config_class.py", line 80, in rehydrate
    module = importlib.import_module(self.module_name)
  File "/home/user/.cache/bazel/_bazel_chaitya/933c2f549343e099e3a6911b282cb71c/external/python_runtime/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dagster_postgres'
is this something that was fixed in a more recent release?
i'm not sure how
dagster.serdes.ConfigurableClass
depends on
dagster_postgres
but it seems like the rehydrate function is trying to import
dagster_postgres
here.
when might the module_name be dagster_postgres?
I guess
dagster_postgres.DagsterPostgresStorage
is the configurable config that something's trying to load somewhere
from what i can tell, dagit depends on some configurable config that is defined in dagster. unfortunately dagster doesn’t have an explicit dep on dagster-postgres (because dagster-postgres depends on dagster), but because dagit does need dagster-postgres, its trying to dynamically import the package… but in bazel that doesn’t seem to fly
please feel free to correct me if i'm wrong
I'm not really sure how to approach this or what a solution might be, whether its on my side or the dagster side
s
it's basically dependency injection: you can choose what storage implementation to use with dagster, and you specify that in dagster.yaml. if you choose postgres, then dagster-postgres needs to be available on the python path.
z
can you add dagster-postgres as a dependency to whatever target you're building dagit with? in pants you can do something like
Copy code
python_sources(
  dependencies=["dagit", "dagster-postgres"]
)
c
yeah, but we run into weird issues downstream when depending on packages that aren't explicitly declared as dependencies upstream. No big deal though, found a workaround. Thanks all!
🎉 1