@@ -25,19 +25,13 @@ def __init__(self) -> None:
2525 self .airflow_bin = "airflow"
2626 self .airflow_invoker = Invoker (self .airflow_bin )
2727
28- self .airflow_home = os .environ .get ("AIRFLOW_HOME" ) or os .environ .get (
29- f"{ self .app_name } _AIRFLOW_HOME"
30- )
28+ self .airflow_home = os .environ .get ("AIRFLOW_HOME" ) or os .environ .get (f"{ self .app_name } _AIRFLOW_HOME" )
3129 if not self .airflow_home :
3230 log .debug ("env dump" , env = os .environ )
33- log .error (
34- "AIRFLOW_HOME not found in environment, unable to function without it"
35- )
31+ log .error ("AIRFLOW_HOME not found in environment, unable to function without it" )
3632 sys .exit (1 )
3733
38- self .airflow_cfg_path = Path (
39- os .environ .get ("AIRFLOW_CONFIG" , f"{ self .airflow_home } /airflow.cfg" )
40- )
34+ self .airflow_cfg_path = Path (os .environ .get ("AIRFLOW_CONFIG" , f"{ self .airflow_home } /airflow.cfg" ))
4135 self .airflow_core_dags_path = Path (
4236 os .path .expandvars (
4337 os .environ .get (
@@ -75,19 +69,15 @@ def initialize(self, force: bool = False) -> None:
7569 "meltano dag generator not found, will be auto-generated" ,
7670 dag_generator_path = dag_generator_path ,
7771 )
78- dag_generator_path .write_bytes (
79- pkgutil .get_data ("files_airflow_ext" , "orchestrate/meltano.py" )
80- )
72+ dag_generator_path .write_bytes (pkgutil .get_data ("files_airflow_ext" , "orchestrate/meltano.py" ))
8173
8274 readme_path = self .airflow_core_dags_path / "README.md"
8375 if not readme_path .exists ():
8476 log .debug (
8577 "meltano dag generator README not found, will be auto-generated" ,
8678 readme_path = readme_path ,
8779 )
88- readme_path .write_bytes (
89- pkgutil .get_data ("files_airflow_ext" , "orchestrate/README.md" )
90- )
80+ readme_path .write_bytes (pkgutil .get_data ("files_airflow_ext" , "orchestrate/README.md" ))
9181
9282 def invoke (self , command_name : str | None , * command_args : Any ) -> None :
9383 """Invoke the airflow command.
@@ -101,9 +91,7 @@ def invoke(self, command_name: str | None, *command_args: Any) -> None:
10191 try :
10292 self .airflow_invoker .run_and_log (command_name , * command_args )
10393 except subprocess .CalledProcessError as err :
104- log_subprocess_error (
105- f"airflow { command_name } " , err , "airflow invocation failed"
106- )
94+ log_subprocess_error (f"airflow { command_name } " , err , "airflow invocation failed" )
10795 sys .exit (err .returncode )
10896
10997 def describe (self ) -> models .Describe :
@@ -115,12 +103,8 @@ def describe(self) -> models.Describe:
115103 # TODO: could we auto-generate all or portions of this from typer instead?
116104 return models .Describe (
117105 commands = [
118- models .ExtensionCommand (
119- name = "airflow_extension" , description = "airflow extension commands"
120- ),
121- models .InvokerCommand (
122- name = "airflow_invoker" , description = "airflow pass through invoker"
123- ),
106+ models .ExtensionCommand (name = "airflow_extension" , description = "airflow extension commands" ),
107+ models .InvokerCommand (name = "airflow_invoker" , description = "airflow pass through invoker" ),
124108 ]
125109 )
126110
@@ -131,9 +115,7 @@ def _create_config(self) -> None:
131115 try :
132116 self .airflow_invoker .run ("--help" , stdout = subprocess .DEVNULL )
133117 except subprocess .CalledProcessError as err :
134- log_subprocess_error (
135- "airflow --help" , err , "initial airflow invocation failed"
136- )
118+ log_subprocess_error ("airflow --help" , err , "initial airflow invocation failed" )
137119 sys .exit (err .returncode )
138120
139121 def _initdb (self ) -> None :
0 commit comments