Skip to content

Instantly share code, notes, and snippets.

@mistercrunch
Created June 15, 2015 19:27
Show Gist options
  • Save mistercrunch/91d90ab05af77c76e1f9 to your computer and use it in GitHub Desktop.
Save mistercrunch/91d90ab05af77c76e1f9 to your computer and use it in GitHub Desktop.
Airflow plugin example
from airflow.hooks.base_hook import BaseHook
from airflow.models import BaseOperator
from airflow.executors.base_executor import BaseExecutor
from airflow import AirflowViewPlugin, AirflowMacroPlugin
from flask_admin import expose
class PluginHook(BaseHook):
pass
class PluginOperator(BaseOperator):
pass
class PluginExecutor(BaseExecutor):
pass
class TestView(AirflowViewPlugin):
@expose('/')
def query(self):
return self.render("anomaly/test.html", content="A VAR")
def return_success():
return "Success!"
anomaly = AirflowMacroPlugin(namespace="anomaly")
anomaly.return_success = return_success
v = TestView(category="Something", name="Super")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment