Merge pull request #10 from mistercrunch/db_conn

Making the sqlachemy db connection a config param
This commit is contained in:
Maxime Beauchemin 2014-11-17 13:02:43 -08:00
Родитель bd726ddc0a b4111cc40c
Коммит 8e4c3762c3
4 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -3,6 +3,7 @@ AIRFLOW_HOME: TO_REPLACE_FROM_OS_ENVIRON
BASE_LOG_FOLDER: %(AIRFLOW_HOME)s/logs
DAGS_FOLDER: %(AIRFLOW_HOME)s/dags
BASE_FOLDER: %(AIRFLOW_HOME)s/airflow
SQL_ALCHEMY_CONN: sqlite:///%(AIRFLOW_HOME)s/airflow.db
[server]
WEB_SERVER_HOST: 0.0.0.0

Просмотреть файл

@ -10,7 +10,6 @@ class AirflowConfigParser(ConfigParser):
if 'AIRFLOW_CONFIG_PATH' in os.environ:
_config_paths.append(os.environ['AIRFLOW_CONFIG_PATH'])
logging.info("Config paths is " + str(_config_paths))
print("Config paths is " + str(_config_paths))
@classmethod
def add_config_paths(cls, path):

Просмотреть файл

@ -3,5 +3,5 @@ from local_executor import LocalExecutor
from sequential_executor import SequentialExecutor
# DEFAULT_EXECUTOR = CeleryExecutor()
# DEFAULT_EXECUTOR = LocalExecutor()
DEFAULT_EXECUTOR = SequentialExecutor()
DEFAULT_EXECUTOR = LocalExecutor()
#DEFAULT_EXECUTOR = SequentialExecutor()

Просмотреть файл

@ -11,12 +11,13 @@ AIRFLOW_HOME = os.environ['AIRFLOW_HOME']
"""
BASE_FOLDER = getconf().get('core', 'BASE_FOLDER')
SQL_ALCHEMY_CONN = getconf().get('core', 'SQL_ALCHEMY_CONN')
if BASE_FOLDER not in sys.path:
sys.path.append(BASE_FOLDER)
Session = sessionmaker()
#engine = create_engine('mysql://airflow:airflow@localhost/airflow')
engine = create_engine('sqlite:///' + BASE_FOLDER + '/airflow.db' )
engine = create_engine(SQL_ALCHEMY_CONN)
Session.configure(bind=engine)
# can't move this to configuration due to ConfigParser interpolation