本文整理汇总了Python中airflow.jobs.SchedulerJob.heartrate方法的典型用法代码示例。如果您正苦于以下问题:Python SchedulerJob.heartrate方法的具体用法?Python SchedulerJob.heartrate怎么用?Python SchedulerJob.heartrate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类airflow.jobs.SchedulerJob
的用法示例。
在下文中一共展示了SchedulerJob.heartrate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scheduler_process_check_heartrate
# 需要导入模块: from airflow.jobs import SchedulerJob [as 别名]
# 或者: from airflow.jobs.SchedulerJob import heartrate [as 别名]
def test_scheduler_process_check_heartrate(self):
"""
Test if process dag honors the heartrate
"""
dag = DAG(
dag_id='test_scheduler_process_check_heartrate',
start_date=DEFAULT_DATE)
dag_task1 = DummyOperator(
task_id='dummy',
dag=dag,
owner='airflow')
session = settings.Session()
orm_dag = DagModel(dag_id=dag.dag_id)
orm_dag.last_scheduler_run = datetime.datetime.now()
session.merge(orm_dag)
session.commit()
session.close()
scheduler = SchedulerJob()
scheduler.heartrate = 1000
dag.clear()
dr = scheduler.schedule_dag(dag)
self.assertIsNotNone(dr)
queue = mock.Mock()
scheduler.process_dag(dag, queue=queue)
queue.put.assert_not_called()
示例2: do_schedule
# 需要导入模块: from airflow.jobs import SchedulerJob [as 别名]
# 或者: from airflow.jobs.SchedulerJob import heartrate [as 别名]
def do_schedule(function, function2):
# Use a empty file since the above mock will return the
# expected DAGs. Also specify only a single file so that it doesn't
# try to schedule the above DAG repeatedly.
scheduler = SchedulerJob(num_runs=1,
executor=executor,
subdir=os.path.join(models.DAGS_FOLDER,
"no_dags.py"))
scheduler.heartrate = 0
scheduler.run()
示例3: do_schedule
# 需要导入模块: from airflow.jobs import SchedulerJob [as 别名]
# 或者: from airflow.jobs.SchedulerJob import heartrate [as 别名]
def do_schedule(function, function2):
scheduler = SchedulerJob(num_runs=1, executor=executor,)
scheduler.heartrate = 0
scheduler.run()