From 35d019b1cb09d57a605806f2cd89618389c2ce3e Mon Sep 17 00:00:00 2001 From: xnuinside Date: Fri, 24 Nov 2023 13:36:34 +0300 Subject: [PATCH] 0.1.2 version, case if some of config sections are not exists - ok --- CHANGELOG.txt | 4 +++- Dockerfile | 2 +- README.md | 10 ++++------ airflow_helper/core.py | 13 ++++++++----- docs/README.rst | 12 +++++++----- pyproject.toml | 2 +- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 257b93b..5b14c9a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,5 @@ -*0.1.1* +*0.1.2* +1. Do not fail if some sections from config are not exists +*0.1.1* 1. Overwrite option added to `airflow-helper load` command \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fb76b70..2ee351d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.11-alpine -RUN pip install airflow-helper==0.1.1 +RUN pip install airflow-helper==0.1.2 WORKDIR /app ENTRYPOINT [ "airflow-helper" ] diff --git a/README.md b/README.md index 0102bb9..923fb72 100644 --- a/README.md +++ b/README.md @@ -264,11 +264,9 @@ Example, to overwrite default airflow host you should provide environment variab 4. Load configs from git 5. Create overwrite mode for settings upload +## Changelog +*0.1.2* +1. Do not fail if some sections from config are not exists -### Inspiration -By Astronomer airflow_settings.yaml https://forum.astronomer.io/t/what-is-the-new-airflow-settings-yaml-file-for/149/21 (that looks like deprecated now) - -And airflow-vars https://github.com/omerzamir/airflow-vars (but I want pure python tool) *0.1.1* - -1. Overwrite oprion added to `airflow-helper load` command \ No newline at end of file +1. Overwrite option added to `airflow-helper load` command \ No newline at end of file diff --git a/airflow_helper/core.py b/airflow_helper/core.py index 0895b89..e08ba1d 100644 --- a/airflow_helper/core.py +++ b/airflow_helper/core.py @@ -26,11 +26,14 @@ def __init__( def upload_config_to_server(self): logger.info(f"Uploading connections to airflow server: {self.api.url}") - self.api.create_connections(self.config.airflow.connections) - logger.info(f"Uploading pools to airflow server: {self.api.url}") - self.api.create_pools(self.config.airflow.pools) - logger.info(f"Uploading variables to airflow server: {self.api.url}") - self.api.create_variables(self.config.airflow.variables) + if self.config.airflow.connections: + self.api.create_connections(self.config.airflow.connections) + if self.config.airflow.pools: + logger.info(f"Uploading pools to airflow server: {self.api.url}") + self.api.create_pools(self.config.airflow.pools) + if self.config.airflow.variables: + logger.info(f"Uploading variables to airflow server: {self.api.url}") + self.api.create_variables(self.config.airflow.variables) class PostAirflowAPI(AirflowAPIBase): diff --git a/docs/README.rst b/docs/README.rst index f961f1d..e31c080 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -295,13 +295,15 @@ TODO #. Load configs from git #. Create overwrite mode for settings upload -Inspiration -^^^^^^^^^^^ +Changelog +--------- -By Astronomer airflow_settings.yaml https://forum.astronomer.io/t/what-is-the-new-airflow-settings-yaml-file-for/149/21 (that looks like deprecated now) +*0.1.2* + + +#. Do not fail if some sections from config are not exists -And airflow-vars https://github.com/omerzamir/airflow-vars (but I want pure python tool) *0.1.1* -#. Overwrite oprion added to ``airflow-helper load`` command +#. Overwrite option added to ``airflow-helper load`` command diff --git a/pyproject.toml b/pyproject.toml index f1d7708..c76dafc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "airflow-helper" -version = "0.1.1" +version = "0.1.2" description = "" authors = ["Iuliia Volkova "] license = "MIT"