Hello, à dagster newbie here. I've been playing ar...
# ask-community
q
Hello, à dagster newbie here. I've been playing around with dagster and I think I am liking it. Question I have is if I have jobs in different Python files, how do I configure dagster to consolidate all these jobs into one repository.
l
Hello! You need to create a
@repository
that is a functions that returns all your jobs. Create a new file that imports your jobs and holds this repository definition function. Finally in the
workspace.yaml
configuration file, add:
Copy code
load_from:
  - python_file: your_repository.py
Details here.
q
I did this but it didn't work. So I had two files.
a.py
and
b.py
. And if all of these hold jobs, do I need a last file
repository.py
that consolidates all these? And in the
repository.py
, is that where I put the
@repository
that returns all the jobs from the different files?
m
yep, or you could do this using an
__init__.py
and a module structure
q
Is there any docs that walks through the _`__init__.py` approach? I feel like that'd_ be more natural as I wouldn't have to import every job into the
repository.py
file but they'd be loaded automatically as I add new jobs
m
you would still need to import your jobs into the
__init__.py
but this would be more in line with ordinary python module organization -- you will still want to define a repository in that file, which has the advantage that you can look in a single place to see all of the jobs you've defined
👍 1