@@ -533,8 +533,7 @@ def __init__(
533
533
num_runs = - 1 ,
534
534
file_process_interval = conf .getint ('scheduler' ,
535
535
'min_file_process_interval' ),
536
- min_file_parsing_loop_time = conf .getint ('scheduler' ,
537
- 'min_file_parsing_loop_time' ),
536
+ processor_poll_interval = 1.0 ,
538
537
run_duration = None ,
539
538
do_pickle = False ,
540
539
log = None ,
@@ -549,6 +548,8 @@ def __init__(
549
548
:type subdir: unicode
550
549
:param num_runs: The number of times to try to schedule each DAG file.
551
550
-1 for unlimited within the run_duration.
551
+ :param processor_poll_interval: The number of seconds to wait between
552
+ polls of running processors
552
553
:param run_duration: how long to run (in seconds) before exiting
553
554
:type run_duration: int
554
555
:param do_pickle: once a DAG object is obtained by executing the Python
@@ -565,6 +566,7 @@ def __init__(
565
566
566
567
self .num_runs = num_runs
567
568
self .run_duration = run_duration
569
+ self ._processor_poll_interval = processor_poll_interval
568
570
569
571
self .do_pickle = do_pickle
570
572
super (SchedulerJob , self ).__init__ (* args , ** kwargs )
@@ -592,10 +594,7 @@ def __init__(
592
594
593
595
self .file_process_interval = file_process_interval
594
596
595
- # Wait until at least this many seconds have passed before parsing files once all
596
- # files have finished parsing.
597
- self .min_file_parsing_loop_time = min_file_parsing_loop_time
598
-
597
+ self .max_tis_per_query = conf .getint ('scheduler' , 'max_tis_per_query' )
599
598
if run_duration is None :
600
599
self .run_duration = conf .getint ('scheduler' ,
601
600
'run_duration' )
@@ -1557,16 +1556,18 @@ def _execute(self):
1557
1556
# DAGs in parallel. By processing them in separate processes,
1558
1557
# we can get parallelism and isolation from potentially harmful
1559
1558
# user code.
1560
- self .log .info ("Processing files using up to %s processes at a time" ,
1561
- self .max_threads )
1559
+ self .log .info (
1560
+ "Processing files using up to %s processes at a time" ,
1561
+ self .max_threads )
1562
1562
self .log .info ("Running execute loop for %s seconds" , self .run_duration )
1563
1563
self .log .info ("Processing each file at most %s times" , self .num_runs )
1564
- self .log .info ("Process each file at most once every %s seconds" ,
1565
- self .file_process_interval )
1566
- self .log .info ("Wait until at least %s seconds have passed between file parsing "
1567
- "loops" , self .min_file_parsing_loop_time )
1568
- self .log .info ("Checking for new files in %s every %s seconds" ,
1569
- self .subdir , self .dag_dir_list_interval )
1564
+ self .log .info (
1565
+ "Process each file at most once every %s seconds" ,
1566
+ self .file_process_interval )
1567
+ self .log .info (
1568
+ "Checking for new files in %s every %s seconds" ,
1569
+ self .subdir ,
1570
+ self .dag_dir_list_interval )
1570
1571
1571
1572
# Build up a list of Python files that could contain DAGs
1572
1573
self .log .info ("Searching for files in %s" , self .subdir )
@@ -1582,7 +1583,6 @@ def processor_factory(file_path):
1582
1583
known_file_paths ,
1583
1584
self .max_threads ,
1584
1585
self .file_process_interval ,
1585
- self .min_file_parsing_loop_time ,
1586
1586
self .num_runs ,
1587
1587
processor_factory )
1588
1588
@@ -1734,13 +1734,17 @@ def _execute_helper(self, processor_manager):
1734
1734
last_stat_print_time = timezone .utcnow ()
1735
1735
1736
1736
loop_end_time = time .time ()
1737
- self .log .debug ("Ran scheduling loop in %.2f seconds" ,
1738
- loop_end_time - loop_start_time )
1737
+ self .log .debug (
1738
+ "Ran scheduling loop in %.2f seconds" ,
1739
+ loop_end_time - loop_start_time )
1740
+ self .log .debug ("Sleeping for %.2f seconds" , self ._processor_poll_interval )
1741
+ time .sleep (self ._processor_poll_interval )
1739
1742
1740
1743
# Exit early for a test mode
1741
1744
if processor_manager .max_runs_reached ():
1742
- self .log .info ("Exiting loop as all files have been processed %s times" ,
1743
- self .num_runs )
1745
+ self .log .info (
1746
+ "Exiting loop as all files have been processed %s times" ,
1747
+ self .num_runs )
1744
1748
break
1745
1749
1746
1750
# Stop any processors
0 commit comments