I'm getting this error when setting up lazy loadin...
# ask-community
b
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
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
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
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
@Dagster Bot issue Lazy loading repository docs example is broken
d