https://dagster.io/ logo
#dagster-support
Title
# dagster-support
h

Harvey Marshall

09/01/2022, 5:22 PM
Hi All,
dagster._core.errors.DagsterInvalidDefinitionError: Bad return value from repository construction function: all elements of list must be of type JobDefinition, GraphDefinition, PipelineDefinition, PartitionSetDefinition, ScheduleDefinition, SensorDefinition, AssetsDefinition, or SourceAsset.Got value of type <class 'module'> at index 0, value of type <class 'module'> at index 1, value of type <class 'module'> at index 2, value of type <class 'module'> at index 3.
Im getting this error when trying to load all my jobs, ops and assets to the repository a little confusing, as I just started with dagster today.
j

jamie

09/01/2022, 5:27 PM
Hi! can you share a code snippet of your repository?
h

Harvey Marshall

09/01/2022, 5:45 PM
yep
Copy code
from dagster import repository
from .assets import cereal
from .ops import get_file_size, api_get, load_config
from .jobs import jobs

ALL_ASSETS = [
    cereal
]

ALL_OPS = [
    get_file_size,
    api_get,
    load_config
]

ALL_JOBS = [
    jobs
]


@repository
def demo_dagster():
    definitions = [
        ALL_OPS,
        ALL_JOBS,
        ALL_ASSETS
    ]

    return definitions
@jamie
j

jamie

09/01/2022, 6:48 PM
I think the main thing here is that ops shouldn't be put in repositories. Another style thing is that the
@repository
decorated function should return a list of jobs, graphs, assets, etc. not a list of lists (we do handle this case on the backend, but it's not recommended style). What happens if you change your code to
Copy code
@repository
def demo_dagster():
    definitions = [
        *ALL_JOBS,
        *ALL_ASSETS
    ]

    return definitions
h

Harvey Marshall

09/02/2022, 6:55 AM
Sorry, Timezone difference. I just made those changes and still receive this error
Copy code
dagster._core.errors.DagsterInvalidDefinitionError: Bad return value from repository construction function: all elements of list must be of type JobDefinition, GraphDefinition, PipelineDefinition, PartitionSetDefinition, ScheduleDefinition, SensorDefinition, AssetsDefinition, or SourceAsset.Got value of type <class 'module'> at index 0, value of type <class 'module'> at index 1.
j

jamie

09/06/2022, 3:09 PM
hmmm ok. it's odd to me that the error message is listing the types it got as
<class module>
and not some more specific type. Usually when this error happens it'll say something like
Got value of type <string>
or
value of type <int>
etc. is the
jobs
in
from .jobs import jobs
a single job definition or some other type?
32 Views