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

TadasG

06/13/2023, 7:47 PM
guys, any idea what is happening, my dagster jobs run and instantly succeed, dagster version is
1.3.9
Copy code
@asset(group_name="hello_world")
def hello_world_asset() -> None:
    print("HELLO WORLD")


hello_world_job = define_asset_job("hello_world_job", AssetSelection.groups("hello_world_asset"))

hello_world_schedule = ScheduleDefinition(job=hello_world_job, cron_schedule="30 */8 * * *")


@repository
def all_apps():
    return [hello_world_schedule]
Nothing is outputted from my code just the task starts and finishes in 0.001 second what jackie it should print "hello world" but doesn't...
Copy code
2023-06-13 22:45:16 +0300 - dagster - DEBUG - hello_world_job - 634b3dd5-6a72-4265-9e3a-d1035622f12f - 254042 - RUN_START - Started execution of run for "hello_world_job".
2023-06-13 22:45:16 +0300 - dagster - DEBUG - hello_world_job - 634b3dd5-6a72-4265-9e3a-d1035622f12f - 254042 - ENGINE_EVENT - Executing steps using multiprocess executor: parent process (pid: 254042)
2023-06-13 22:45:16 +0300 - dagster - DEBUG - hello_world_job - 634b3dd5-6a72-4265-9e3a-d1035622f12f - 254042 - ENGINE_EVENT - Multiprocess executor: parent process exiting after 0.09ms (pid: 254042)
2023-06-13 22:45:16 +0300 - dagster - DEBUG - hello_world_job - 634b3dd5-6a72-4265-9e3a-d1035622f12f - 254042 - RUN_SUCCESS - Finished execution of run for "hello_world_job".
However if I run it like this:
Copy code
from dagster import repository, ScheduleDefinition, job


@job
def hello_world_asset() -> None:
    print("HELLO WORLD")


hello_world_schedule = ScheduleDefinition(job=hello_world_asset, cron_schedule="30 */8 * * *")


@repository
def all_apps():
    return [hello_world_schedule]
Then my job starts twice and then when I run it from the dagit console it runs just fine and does what I want. what jackie
z

Zach

06/13/2023, 7:54 PM
How are you calling your asset job?
t

TadasG

06/13/2023, 7:54 PM
Copy code
poetry run dagster dev
but on kubernetes it's the same thing, regular helm chart
with a specified path for repos.py file
z

Zach

06/13/2023, 7:55 PM
are you submitting the job through Dagit or something?
dagster dev
doesn't run any jobs directly
t

TadasG

06/13/2023, 7:55 PM
yeah that's the point, when I run
poetry run dagster dev
the job starts in the example I specified 😄
and dagster doesn't run until the job finishes
but with
define_asset_job
the job just finishes instantly when I trigger it through dagit
z

Zach

06/13/2023, 7:58 PM
I'm still a little confused as to why
dagster dev
is causing a job to run unless it's being executed at the global level somewhere. But one thing that's suspicious to me is that your AssetSelection.groups is pointing to a slightly different name than the group that
hello_world_asset
is defined as...
Also would be interested to see if output gets captured if you used the dagster logger, like
Copy code
@asset(group_name="hello_world")
def hello_world_asset(context) -> None:
    <http://context.log.info|context.log.info>("HELLO WORLD")
o

owen

06/13/2023, 8:50 PM
hi @TadasG! another suspicious bit to me is:
Copy code
@job
def hello_world_asset() -> None:
    print("HELLO WORLD")
The code inside an
@job
decorated function is meant purely for defining dependencies between ops, and will be executed immediately upon importing the code. essentially, you're defining a job with no ops (so it completes instantly), and as a side-effect of defining the job, your message gets printed.
❤️ 2
z

Zach

06/13/2023, 8:53 PM
Good catch Owen!
blob salute 1
t

TadasG

06/14/2023, 5:41 AM
thank you guys!! will check it
2 Views