https://dagster.io/ logo
Title
q

Qwame

12/02/2021, 10:35 AM
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

Louis Auneau

12/02/2021, 11:09 AM
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:
load_from:
  - python_file: your_repository.py
Details here.
q

Qwame

12/02/2021, 4:28 PM
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

max

12/02/2021, 4:33 PM
yep, or you could do this using an
__init__.py
and a module structure
q

Qwame

12/02/2021, 4:37 PM
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

max

12/02/2021, 4:41 PM
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