Is there way to get the reference to the repositor...
# ask-community
s
Is there way to get the reference to the repository created by dagster inside another job and job? I mean how I get a reference to "core_generic" (see image). I want to use the method "`get_job`" of the repository
s
Do you mean like via a
context
object? This isn't currently possible, but if you file an issue, we might be able to add it. Alternatively, you could just import it inside your op/asset and access it that way?
s
I want to get an job in the same way I am getting it using definition. (See image) . so I want to do the same but with repository. is possible?
I want to use "execute_in_process". for that reason I want to the get job
s
ah yes - you can use
my_repository_def.get_job("job_name")
s
Yes but how do I get the "my_repository_def" reference .... If I do it in the same way I get an error
s
are you able to import it?
s
thinking a little but about this... the decorator normally execute and return a new function, for that reason I got the error.... mmmm how can I do this in other way?
s
oo wait a sec
you'd need to put that code inside an op, not a job
@job
-decorated functions shouldn't have any logic in them other than stringing together ops and graphs: https://github.com/dagster-io/dagster/discussions/12554
❤️ 1
🌈 1
s
yeah you are right..thanks Sandy
Hi @sandy . After your suggestion everything is ok but now when I move the operation to it's own folder i am getting an error of "circular error" and is understandable because I am importing the ops on my "repository.py" and inside the ops I need to import the "repository" What is the dagster way to tackle this? I have in mind some hacky ways but I don't want to do it. Maybe using "DasgterInstance" can get the repository?
s
I believe you need to move the import
from ..repository import core_generic
inside the
execute_dbt_project_asset_job
function