https://dagster.io/ logo
#announcements
Title
# announcements
s

szalai1

07/22/2020, 1:57 PM
hey, I have the following setup: • dagster on k8s • same pod executes the scheduled pipelines too • cron is running in the pod •
schedule_storage: postgres
my problem: • scheduled jobs don't start when they supposed to • when I run
dagster schedule up --location 'Business Intelligence'
I get this every time:
Copy code
Errors Resolved:
Schedule daily_answer_position_pipeline is set to be running, but the scheduler is not running the schedule.
Schedule daily_events_rounds_pipeline is set to be running, but the scheduler is not running the schedule
I renamed the repo several times, now when I run
dagster schedule debug
I can see schedules from those repos with
status: RUNNING
what can be the problem?
s

sashank

07/22/2020, 2:18 PM
Hey @szalai1, you can check for runtime errors with the schedule using the
dagster schedule logs
command
Try running
dagster schedule logs --location 'Business Intelligence' daily_answer_position_pipeline
Also if you have dagit running, try clicking on the schedule name within dagit to go to the schedule-specific view. You may see helpful error messages there.
s

szalai1

07/22/2020, 2:41 PM
on Dagit I cannot see previous runs.
when I check the logs the log files are empty
it seems like it never tried to execute the pipelines
if I run the script scheduled in cron, manually. the run appears on Dagit
t

Titouan

07/22/2020, 3:03 PM
If you use the helm package to deploy Dagster on your k8s cluster, you need to change the command in the h*`elm/dagster/templates/deployment-dagit.yaml`* and add the scheduler commands.
s

szalai1

07/22/2020, 3:04 PM
i did the
schedule up
but not the
--start-all
thanks
s

sashank

07/22/2020, 3:05 PM
The
--start-all
shouldn’t really matter, since you have manually started the schedule through the UI.
s

szalai1

07/22/2020, 3:06 PM
I manually started from the pod
I run the script genereted by dagster
with
crontab -l
, I listed the scheduled jobs
s

sashank

07/22/2020, 3:07 PM
Were the jobs listed there?
Could you post the output of your
dagster schedule debug
command here? It should show us everything including the cron tab
s

szalai1

07/22/2020, 3:08 PM
Copy code
root@dagster-dagit-6f6c6c64bd-85jpw:/opt/dagster/app# dagster schedule debug

Errors (Run `dagster schedule up` to resolve)
=============================================
Schedule daily_answer_position_pipeline is set to be running, but the scheduler is not running the schedule.
Schedule daily_events_rounds_pipeline is set to be running, but the scheduler is not running the schedule.

Scheduler Configuration
=======================
Scheduler:
     module: dagster_cron.cron_scheduler
     class: SystemCronScheduler
     config:
       {}


Scheduler Info
==============
Running Cron Jobs:
0 1 * * * /opt/dagster/dagster_home/schedules/scripts/cb7af3fe21f2fc954ea60dad4502658594ede1fa.sh > /opt/dagster/dagster_home/schedules/logs/cb7af3fe21f2fc954ea60dad4502658594ede1fa/scheduler.log 2>&1 # dagster-schedule: cb7af3fe21f2fc954ea60dad4502658594ede1fa
@daily /opt/dagster/dagster_home/schedules/scripts/f9b01b67ce89b111f67ea06bf192c062e5698471.sh > /opt/dagster/dagster_home/schedules/logs/f9b01b67ce89b111f67ea06bf192c062e5698471/scheduler.log 2>&1 # dagster-schedule: f9b01b67ce89b111f67ea06bf192c062e5698471
@daily /opt/dagster/dagster_home/schedules/scripts/b03f3aa7aa968b38665e82bfb4fecbbf405c280a.sh > /opt/dagster/dagster_home/schedules/logs/b03f3aa7aa968b38665e82bfb4fecbbf405c280a/scheduler.log 2>&1 # dagster-schedule: b03f3aa7aa968b38665e82bfb4fecbbf405c280a
@daily /opt/dagster/dagster_home/schedules/scripts/3f340cb3cd5b02d635e20de3012be5aec6d28fe4.sh > /opt/dagster/dagster_home/schedules/logs/3f340cb3cd5b02d635e20de3012be5aec6d28fe4/scheduler.log 2>&1 # dagster-schedule: 3f340cb3cd5b02d635e20de3012be5aec6d28fe4


Scheduler Storage Info
======================
daily_answer_position_pipeline:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: 94883ff7995e2aeb02a9caf1f8ba503b654dd122
  repository_pointer: /opt/dagster/app/src/repositories.py::kafka_topic_loader_repository
  schedule_origin_id: d5c6079c7dfb3d375c01e431aad6a52c0d24f978
  status: STOPPED

daily_events_rounds_pipeline:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: 94883ff7995e2aeb02a9caf1f8ba503b654dd122
  repository_pointer: /opt/dagster/app/src/repositories.py::kafka_topic_loader_repository
  schedule_origin_id: 60590970adb2fa159911597e625a5cdffeab4e78
  status: STOPPED

daily_answer_position_pipeline:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: c2a9de0a59b1f05956c1688d4c3a7dce90d949ea
  repository_pointer: /opt/dagster/app/src/repositories.py::bi_repository
  schedule_origin_id: e785e863d275b277ec030e30e446e60a68412c11
  status: RUNNING

daily_events_rounds_pipeline:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: c2a9de0a59b1f05956c1688d4c3a7dce90d949ea
  repository_pointer: /opt/dagster/app/src/repositories.py::bi_repository
  schedule_origin_id: 4ac68c41140226dc41b6382b02e37117baba6d5f
  status: RUNNING

daily_answer_position_pipeline:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: cd0eff9914141ed9ca53ba32b71349d7d82a9903
  repository_pointer: /opt/dagster/app/src/repositories.py::business_intelligence_repository
  schedule_origin_id: f9b01b67ce89b111f67ea06bf192c062e5698471
  status: RUNNING

daily_events_rounds_pipeline:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: cd0eff9914141ed9ca53ba32b71349d7d82a9903
  repository_pointer: /opt/dagster/app/src/repositories.py::business_intelligence_repository
  schedule_origin_id: b03f3aa7aa968b38665e82bfb4fecbbf405c280a
  status: RUNNING

daily_maker_organisation_changes:
  cron_schedule: 0 0 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: cd0eff9914141ed9ca53ba32b71349d7d82a9903
  repository_pointer: /opt/dagster/app/src/repositories.py::business_intelligence_repository
  schedule_origin_id: 3f340cb3cd5b02d635e20de3012be5aec6d28fe4
  status: RUNNING

daily_aggregate_model_monitoring_pipeline:
  cron_schedule: 0 1 * * *
  python_path: /usr/local/bin/python
  repository_origin_id: 1837b1588a140ee6a1f478dc3d0bece0c3c083d4
  repository_pointer: /opt/dagster/app/src/model_repo.py::ds_models_repository
  schedule_origin_id: cb7af3fe21f2fc954ea60dad4502658594ede1fa
  status: RUNNING
I renamed
bi_repository
repo to
business_intelligence_repository
, but I still can see the schedules in there ^
s

sashank

07/22/2020, 3:12 PM
Ah the rename is problematic. This is because the location name also changes, and the scheduler does not know to delete the schedules from the previous location when running
up
with the new location. To prevent this again, I would recommend manually setting a location name in your
dagster.yaml
that stays consistent. For now, the first thing I would do is run
dagster schedule wipe
then
dagster schedule up
again to get us into a clean state.
Then, I would start the schedule you want to debug (perhaps set it to run soon or on a short interval so we can make sure it runs successfully), and once you know the scheduled time is passed then check the logs. It should have some output since we redirect all output from the script command to the log file
s

szalai1

07/22/2020, 3:16 PM
thank you @sashank, I'll do as you advised
s

sashank

07/22/2020, 3:16 PM
If there is no output, that would probably mean that cron service itself is not running. We can check if cron is running by adding a test cron job (perhaps echo something to a file) and check if it runs
Copy code
* * * * * echo "test" > testfile.txt
Let me know if you end up verifying cron is running but there is no output in the log files, or if
dagster schedule debug
shows and issues after you run
dagster schedule up
and
dagster schedule up
s

szalai1

07/23/2020, 8:42 AM
@sashank my findings: • cron starts the job •
scheduled.log
is empty • there are files like this
20200723T070117_f9b01b67ce89b111f67ea06bf192c062e5698471.result
though. and an error message:
You have attempted to fetch the environment variable \"DAGSTER_PG_PASSWORD\" which is not set.
which makes sense as cron just starts the script, but nothing sets the env vars before that.
schedule config from my
dagster.yaml
Copy code
schedule_storage:
      module: dagster_postgres.schedule_storage
      class: PostgresScheduleStorage
      config:
        postgres_db:
          username: dagster 
          password:
            env: DAGSTER_PG_PASSWORD
          hostname: dagster-postgresql
          db_name:  dagster
          port: 5432
s

sashank

07/23/2020, 2:59 PM
Since cron runs in a separate, mostly empty environment, it doesn’t have the same env vars as your default shell. However, each schedule decorator takes an environment_vars argument that lets you copy over the required env vars to the shell script that is invoked by the scheduler.
s

szalai1

07/23/2020, 3:03 PM
this is brilliant, thank you very much @sashank . I'm supper excited about dagster, thanks for the great tool and the support. Take care !
s

sashank

07/23/2020, 3:04 PM
That’s great to hear! Please let me know if you still run into issues after specifying the env vars or if we can help in any other way
🙌 1
p

Paul Wyatt

07/23/2020, 8:07 PM
@Travis Cline @aqm this is what's causing our current problem
👍 2
s

szalai1

07/24/2020, 7:11 AM
another gotcha: env vars are put into the generated script as without quotes, which means that if you have special characters (e.g
(
) then it will make generated script fail with syntax error. I solved the problem by escaping the string :
f"\"{os.environ.get(key)}\""
.
2 Views