The code work with Python 3.12.11.
Info : You can use pyenv to manage Python versions
Create venv :
python -m venv .venvActivate venv :
source .venv/bin/activateInstall requirements :
pip install -r requirements.txtRun all tests :
pytestRun all tests except slow tests:
pytest -m "not slow"Run all tests except tests that require VPN connection:
pytest -m "not vpn"Configuration files of containers are in: configs/.
All datas (Airflow logs, Minio files, postgres data) are in: data/.
- Create
.envfile :
make setup- Deploy stack :
make startYou can still use the old compose file:
docker-compose up(Airflow logs will be in the
logs/folder)
If you are using the clin-localstack project, or an existing Minio instance, the Minio instance can be used as S3 solution for this local setup.
Configuration files of containers are in: configs/.
All datas (Airflow logs, postgres data) are in: data/.
- Create the .env file
make setup_localstack- Start containers
make start_localstackLogin to Airflow UI :
- URL :
http://localhost:50080 - Username :
airflow - Password :
airflow
Import Airflow variables:
- Airflow UI => Admin => Variables
- Upload file:
variables.json.
Variables should be:
- environment :
qa - kubernetes_namespace :
cqgc-qa - kubernetes_context_default :
kubernetes-admin-cluster.qa.cqgc@cluster.qa.cqgc - kubernetes_context_etl :
kubernetes-admin-cluster.etl.cqgc@cluster.etl.cqgc - base_url (optional) :
http://localhost:50080 - show_test_dags (optional) :
yes - s3_conn_id :
minio
Test one task :
docker-compose exec airflow-scheduler airflow tasks test <dag> <task> 2022-01-01Login to Airflow UI :
- URL :
http://localhost:50080 - Username :
airflow - Password :
airflow
Create Airflow connection:
- Airflow UI => Admin => Connections
- Set connection data:
- Connection Id :
minio - Connection Type :
Amazon Web Services - Extra :
// For default setup
{
"endpoint_url": "http://minio:9000",
"verify": false,
"aws_access_key_id": "minioadmin",
"aws_secret_access_key": "minioadmin"
}
// For external minio setup
{
"endpoint_url": "http://minio-external:9000",
"verify": false,
"aws_access_key_id": "<your minio access key>",
"aws_secret_access_key": "<your minio password key>"
}- Airflow UI => Admin => Connections
- Set connection data:
- Connection Id :
gnomad - Connection Type :
Amazon Web Services - Extra :
{
"config_kwargs": {
"signature_version": "unsigned"
}
}Can be a host <=> ip resolution issue in local. Add to your /etc/hosts file the following :
10.128.81.22 k8-api.etl.cqgc.hsj.rtss.qc.ca
10.128.81.202 k8-api.qa.cqgc.hsj.rtss.qc.ca