Hi guys. Why does annotating a function with @job ...
# ask-community
a
Hi guys. Why does annotating a function with @job automatically runs the function before the dagster instance runs?
z
Dagster calls the function decorated by
@job
so it can construct the graph of ops described in the function, so it can display the graph. If you're calling vanilla python functions in the
@job
function as well then those will get executed. You should only be calling
@ops
from within a
@job
definition
a
i'm not using asset job, i'm using job directly on top of my function
how can i debug this?
i just have a basic config
importing my assets (funtions)
z
I would isolate your job into a smaller set of code that you try to load into Dagster
Oh wait I may have said something that's slightly incorrect
Please show your job code - Dagster does execute the function wrapped by
@job
, but you should only be calling ops there not vanilla python functions
a
it's running
z
Dagster has to call the function at load time to construct the graph / determine the dependencies between ops (otherwise it wouldn't be able to display what ops are in a job). So if you're trying to execute vanilla python functions in a job definition it'll execute those. So you should only be calling ops in the
@job
definition
a
ok
this makes sence. i saw something similar in the docs
i didn't develop the script inside dagster
now i'm integrating it. so far the asset materialization and asset defined jobs do work
maybe i'm going with that