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

ron burgundy

03/11/2024, 11:57 PM
Hi is there any way to prevent Dagster from automatically running jobs when launching the web UI? It is launching a long-running job when I run
dagster dev -w workspace.yaml
which blocks the UI from displaying. This is my job definition:
Copy code
@job(name='myjob')
def backdate_item():
    long_running_job()

defs = Definitions(
    jobs=[backdate_item],
)
Dagster is calling
long_running_job()
on startup, because if I were to raise an exception, Dagster won't start:
Copy code
def long_running_job():
    raise Exception("Why is it calling my code on startup?")
This is really inconvenient to have to run all jobs on startup.
z

Zach

03/12/2024, 2:06 PM
What is the code for
long_running_job
? Is it a
@graph
/
@op
? or something else?
Dagster executes everything in a
@job
or
@graph
definition at the time your code is loaded. Dagster only expects you to use
@ops
or
@graphs
within a
@job
or
@graph
definition, and uses the ops / graphs in a job / graph definition to construct the dependency graph - this is how it shows you what your dependency tree looks like. If you only use ops and graph in your job definitions, execution of the actual job will be deferred until you actually run the job
r

ron burgundy

03/12/2024, 3:07 PM
I see. that makes sense. Thanks for your help, it worked
🎉 1
2 Views