Esempio n. 1
0
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)
Esempio n. 2
0
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):
Esempio n. 3
0
 def parse_from_str(self, s):
     return parse_bool(s)
Esempio n. 4
0
 def getboolean(self, section, key, **kwargs):
     return parse_bool(self.get(section, key, **kwargs))