def environ_enabled(variable_name, default=False): env_value = os.environ.get(variable_name, None) if env_value is None: return default from dbnd._core.utils.basics.helpers import parse_bool return parse_bool(env_value)
import inspect import os import sys from airflow import DAG from airflow.utils.dates import days_ago from dbnd._core.utils.basics.helpers import parse_bool from dbnd_airflow.tracking.dbnd_dag_tracking import track_dag start_days_ago = int(os.environ.get("SCENARIOS__START_DAYS_AGO", "10")) catchup = parse_bool(os.environ.get("SCENARIOS__CATCHUP", "False")) output_root = os.environ.get("SCENARIOS__OUTPUT_ROOT", "/tmp/staging/outputs") DEFAULT_ARGS = { "owner": "staging", "start_date": days_ago(start_days_ago), "catchup": catchup, } def dag_task_output(*path): return os.path.join(output_root, *path) def dag_task_output_partition_csv(name): return dag_task_output("%s.{{ds}}.csv", name) def txcom(task_id):
def parse_from_str(self, s): return parse_bool(s)
def getboolean(self, section, key, **kwargs): return parse_bool(self.get(section, key, **kwargs))