I have put together a ETL job written in Python. I have to run it through different environments (LOCAL, DEV, TST, PROD) so I need to find a way to set the job schedule using environment variables so that I can set different schedules for each environment without touching the code from one environment to another. Today I am using apscheduler. I have something like this in the code:
from apscheduler.schedulers.blocking import BlockingScheduler
def etl_job():
sched = BlockingScheduler(daemon=True)
sched.add_job(etl_job,'interval',minutes=7)
sched.start()
Does anyone know now to solve this? Thanks!
Here how I've solved this one:
Environment variable (json format)
Read the env variable
Schedule each one of the jobs