Skip to content

Commit 5034304

Browse files
gsakkiskaxil
authored andcommitted
[AIRFLOW-796] Add processor_poll_interval and num_runs to config (apache#5009)
cherry-picked from 8751133
1 parent c026f64 commit 5034304

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

airflow/bin/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ class CLIFactory(object):
18521852
help="Set number of seconds to execute before exiting"),
18531853
'num_runs': Arg(
18541854
("-n", "--num_runs"),
1855-
default=-1, type=int,
1855+
default=conf.getint('scheduler', 'num_runs', fallback=-1), type=int,
18561856
help="Set the number of runs to execute before exiting"),
18571857
# worker
18581858
'do_pickle': Arg(

airflow/config_templates/default_airflow.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,13 @@ scheduler_heartbeat_sec = 5
497497
# -1 indicates to run continuously (see also num_runs)
498498
run_duration = -1
499499

500+
# The number of times to try to schedule each DAG file
501+
# -1 indicates unlimited number
502+
num_runs = -1
503+
504+
# The number of seconds to wait between consecutive DAG file processing
505+
processor_poll_interval = 1
506+
500507
# after how much time (seconds) a new DAGs should be picked up from the filesystem
501508
min_file_process_interval = 0
502509

airflow/jobs/scheduler_job.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,9 @@ def __init__(
328328
dag_id=None,
329329
dag_ids=None,
330330
subdir=settings.DAGS_FOLDER,
331-
num_runs=-1,
332-
processor_poll_interval=1.0,
331+
num_runs=conf.getint('scheduler', 'num_runs', fallback=-1),
332+
processor_poll_interval=conf.getfloat(
333+
'scheduler', 'processor_poll_interval', fallback=1),
333334
run_duration=None,
334335
do_pickle=False,
335336
log=None,

0 commit comments

Comments
 (0)