https://dagster.io/ logo
#ask-community
Title
# ask-community
b

Bryan Chavez

04/08/2022, 1:34 AM
I'm getting this error when setting up lazy loading of jobs: UserWarning: Error loading repository location repository_test.pydagster.core.errors.DagsterInvalidDefinitionError Object mapped to expensive_job is not an instance of JobDefinition or GraphDefinition.
Copy code
from dagster import job, op, repository


@op
def return_n(n):
    return n


def make_expensive_job():
    @job
    def expensive_job():
        for i in range(10000):
            return_n()

    return expensive_job


@repository
def lazy_loaded_repository():
    return {
        'jobs': {'expensive_job': make_expensive_job},
    }
v

Vince van Noort

04/08/2022, 7:23 AM
Hi @Bryan Chavez, I think changing it to
Copy code
'jobs': {'expensive_job': make_expensive_job()},
would solve your issue.
make_expensive_job
itself is not a job, it returns a job.
b

Bryan Chavez

04/08/2022, 11:08 AM
does that make it lazy? I'm assuming calling that will actually create the job which defeats the purpose. This is same example that's in the docs: https://docs.dagster.io/_apidocs/repositories
v

Vince van Noort

04/08/2022, 11:41 AM
Hmm, I understand. Unfortunately have no idea how you would fix that. Maybe some error checking changed recently without keeping in mind this example. Maybe someone actually from Dagster can help out?
j

johann

04/08/2022, 3:37 PM
@Dagster Bot issue Lazy loading repository docs example is broken
d

Dagster Bot

04/08/2022, 3:37 PM
3 Views