guys, any idea what is happening, my dagster jobs ...
# ask-community
t
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
How are you calling your asset job?
t
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
are you submitting the job through Dagit or something?
dagster dev
doesn't run any jobs directly
t
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
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
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
Good catch Owen!
blob salute 1
t
thank you guys!! will check it