本文整理汇总了Python中airflow.plugins_manager.AirflowPlugin方法的典型用法代码示例。如果您正苦于以下问题:Python plugins_manager.AirflowPlugin方法的具体用法?Python plugins_manager.AirflowPlugin怎么用?Python plugins_manager.AirflowPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类airflow.plugins_manager
的用法示例。
在下文中一共展示了plugins_manager.AirflowPlugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_warning_about_incompatible_plugins
# 需要导入模块: from airflow import plugins_manager [as 别名]
# 或者: from airflow.plugins_manager import AirflowPlugin [as 别名]
def test_should_warning_about_incompatible_plugins(self):
class AirflowDeprecatedAdminViewsPlugin(AirflowPlugin):
name = "test_admin_views_plugin"
admin_views = [mock.MagicMock()]
class AirflowDeprecatedAdminMenuLinksPlugin(AirflowPlugin):
name = "test_menu_links_plugin"
menu_links = [mock.MagicMock()]
from airflow import plugins_manager
plugins_manager.plugins = [
AirflowDeprecatedAdminViewsPlugin(),
AirflowDeprecatedAdminMenuLinksPlugin()
]
with self.assertLogs(plugins_manager.log) as cm:
plugins_manager.initialize_web_ui_plugins()
self.assertEqual(cm.output, [
'WARNING:airflow.plugins_manager:Plugin \'test_admin_views_plugin\' may not be '
'compatible with the current Airflow version. Please contact the author of '
'the plugin.',
'WARNING:airflow.plugins_manager:Plugin \'test_menu_links_plugin\' may not be '
'compatible with the current Airflow version. Please contact the author of '
'the plugin.'
])
示例2: test_should_response_200_support_plugins
# 需要导入模块: from airflow import plugins_manager [as 别名]
# 或者: from airflow.plugins_manager import AirflowPlugin [as 别名]
def test_should_response_200_support_plugins(self):
class GoogleLink(BaseOperatorLink):
name = "Google"
def get_link(self, operator, dttm):
return "https://www.google.com"
class S3LogLink(BaseOperatorLink):
name = "S3"
operators = [BigQueryExecuteQueryOperator]
def get_link(self, operator, dttm):
return "https://s3.amazonaws.com/airflow-logs/{dag_id}/{task_id}/{execution_date}".format(
dag_id=operator.dag_id,
task_id=operator.task_id,
execution_date=quote_plus(dttm.isoformat()),
)
class AirflowTestPlugin(AirflowPlugin):
name = "test_plugin"
global_operator_extra_links = [
GoogleLink(),
]
operator_extra_links = [
S3LogLink(),
]
with mock_plugin_manager(plugins=[AirflowTestPlugin]):
response = self.client.get(
"/api/v1/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID/taskInstances/TEST_SINGLE_QUERY/links"
)
self.assertEqual(200, response.status_code, response.data)
self.assertEqual(
{
"BigQuery Console": None,
"Google": "https://www.google.com",
"S3": (
"https://s3.amazonaws.com/airflow-logs/"
"TEST_DAG_ID/TEST_SINGLE_QUERY/2020-01-01T00%3A00%3A00%2B00%3A00"
),
},
response.json,
)