Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks/1019 flowetl debugging test failures #1066

Merged
merged 4 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- FlowDB now includes Paul Ramsey's [OGR foreign data wrapper](https://github.com/pramsey/pgsql-ogr-fdw), for easy loading of GIS data. [#1512](https://github.com/Flowminder/FlowKit/issues/1512)
- FlowETL now allows all configuration options to be set using docker secrets. [#1515](https://github.com/Flowminder/FlowKit/issues/1515)
- Added a new component, AutoFlow, to automate running Jupyter notebooks when new data is added to FlowDB. [#1570](https://github.com/Flowminder/FlowKit/issues/1570)
- `FLOWETL_INTEGRATION_TESTS_SAVE_AIRFLOW_LOGS` environment variable added to allow copying the Airflow logs in FlowETL integration tests into the /mounts/logs directory for debugging. [#1019](https://github.com/Flowminder/FlowKit/issues/1019)

### Changed
- FlowDB is now built on PostgreSQL 12 [#1396](https://github.com/Flowminder/FlowKit/issues/1313) and PostGIS 3.
Expand Down
1 change: 1 addition & 0 deletions flowetl/mounts/logs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Logs location
20 changes: 19 additions & 1 deletion flowetl/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def container_env():
"AIRFLOW__CORE__FERNET_KEY": "ssgBqImdmQamCrM9jNhxI_IXSzvyVIfqvyzES67qqVU=",
"AIRFLOW__CORE__SQL_ALCHEMY_CONN": f"postgres://{flowetl_db['POSTGRES_USER']}:{flowetl_db['POSTGRES_PASSWORD']}@flowetl_db:5432/{flowetl_db['POSTGRES_DB']}",
"AIRFLOW_CONN_FLOWDB": f"postgres://{flowdb['POSTGRES_USER']}:{flowdb['POSTGRES_PASSWORD']}@flowdb:5432/flowdb",
"AIRFLOW_HOME": os.environ["AIRFLOW_HOME"],
"POSTGRES_USER": "flowetl",
"POSTGRES_PASSWORD": "flowetl",
"POSTGRES_DB": "flowetl",
Expand Down Expand Up @@ -161,7 +162,8 @@ def mounts(postgres_data_dir_for_tests, flowetl_mounts_dir):
"""
config_mount = Mount("/mounts/config", f"{flowetl_mounts_dir}/config", type="bind")
files_mount = Mount("/mounts/files", f"{flowetl_mounts_dir}/files", type="bind")
flowetl_mounts = [config_mount, files_mount]
logs_mount = Mount("/mounts/logs", f"{flowetl_mounts_dir}/logs", type="bind")
flowetl_mounts = [config_mount, files_mount, logs_mount]

data_mount = Mount(
"/var/lib/postgresql/data", postgres_data_dir_for_tests, type="bind"
Expand Down Expand Up @@ -330,6 +332,22 @@ def wait_for_container(
)
wait_for_container()
yield container

save_airflow_logs = (
os.getenv("FLOWETL_INTEGRATION_TESTS_SAVE_AIRFLOW_LOGS", "FALSE").upper()
== "TRUE"
)
if save_airflow_logs:
logger.info(
"Saving airflow logs to /mounts/logs/ and outputting to stdout "
"(because FLOWETL_INTEGRATION_TESTS_SAVE_AIRFLOW_LOGS=TRUE)."
)
container.exec_run("bash -c 'cp -r $AIRFLOW_HOME/logs/* /mounts/logs/'")
airflow_logs = container.exec_run(
"bash -c 'find /mounts/logs -type f -exec cat {} \;'"
)
logger.info(airflow_logs)

container.kill()
container.remove()

Expand Down