Skip to content

Commit 98ab05a

Browse files
authored
Merge pull request #3 from bcdev/yogesh-xxx-airflow_3
Upgrade to `Airflow 3.0`
2 parents 7ebfe8c + 511a3ff commit 98ab05a

24 files changed

+338
-193
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22

33
[![Unittest Gaiaflow](https://github.com/bcdev/gaiaflow/actions/workflows/unittest.yml/badge.svg)](https://github.com/bcdev/gaiaflow/actions/workflows/unittest.yml)
44
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/ruff)
5+
[![Docs](https://img.shields.io/badge/docs-mkdocs-blue)](https://bcdev.github.io/gaiaflow/)
6+
![Static Badge](https://img.shields.io/badge/Airflow-3.0-8A2BE2?logo=apacheairflow)
7+
![Static Badge](https://img.shields.io/badge/MLFlow-darkblue?logo=mlflow)
8+
![Static Badge](https://img.shields.io/badge/MinIO-red?logo=minio)
9+
![Static Badge](https://img.shields.io/badge/Jupyter-grey?logo=jupyter)
10+
![Static Badge](https://img.shields.io/badge/Minikube-lightblue?logo=kubernetes)
11+
512
![Gaiaflow](assets/gaiaflow.png)
613

14+
715
<sub>(Image created using ChatGPT)</sub>
816

917
The word `GaiaFlow` is a combination of `Gaia` (the Greek goddess of Earth, symbolizing our planet)
@@ -98,7 +106,9 @@ Any files or folders marked with `^` can be extended, but carefully.
98106
├── utils.py * # Utility function to get the minikube gateway IP required for testing.
99107
├── docker_config.py * # Utility function to get the docker image name based on your project.
100108
├── kube_config_inline * # This file is needed for Airflow to communicate with Minikube when testing locally in a prod env.
101-
└── dockerfiles/ * # Dockerfiles and compose files
109+
├── airflow_test.cfg * # This file is needed for testing your airflow dags.
110+
├── Dockerfile ^ # Dockerfile for your package.
111+
└── dockerfiles/ * # Dockerfiles required by Docker compose
102112
```
103113

104114

@@ -245,7 +255,7 @@ Once the pre-requisites are done, you can go ahead with the project creation:
245255
When prompted for input, enter the details requested. If you dont provide any
246256
input for a given choice, the first choice from the list is taken as the default.
247257

248-
Once the project is created, please read the README.md from that.
258+
Once the project is created, please read the [user guide](https://bcdev.github.io/gaiaflow/dev/).
249259

250260

251261
## Troubleshooting
@@ -322,3 +332,16 @@ If you face any other problems not mentioned above, please reach out to us.
322332
- [Minio](https://min.io/docs/minio/container/index.html)
323333
- [JupyterLab](https://jupyterlab.readthedocs.io/)
324334
- [Minikube](https://minikube.sigs.k8s.io/docs/)
335+
336+
337+
### TODO:
338+
339+
Make ECR work. How to add credentials?
340+
341+
S3 credentials access?
342+
343+
Add sensor based DAGs
344+
345+
Make CI unittest using conda instead
346+
347+
Update CI to use ECR credentials.

docs/dev.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Any files or folders marked with `^` can be extended, but carefully.
4343
├── utils.py * # Utility function to get the minikube gateway IP required for testing.
4444
├── docker_config.py * # Utility function to get the docker image name based on your project.
4545
├── kube_config_inline * # This file is needed for Airflow to communicate with Minikube when testing locally in a prod env.
46+
├── airflow_test.cfg * # This file is needed for testing your airflow dags.
4647
├── Dockerfile ^ # Dockerfile for your package.
4748
└── dockerfiles/ * # Dockerfiles required by Docker compose
4849
```
@@ -125,10 +126,11 @@ Then start the MLOps services using:
125126
python mlops_mananger.py --start -b
126127
```
127128

128-
NOTE: When you run this for the first time, make sure you use the `-b` flag as
129-
it builds the images for the first time as shown above.
130-
Next time when you start it again, you start it without the flag as it saves
131-
time by not building the same images again:
129+
130+
131+
**NOTE**: The `-b` flag only needs to be used for the first time.
132+
For consecutive starts
133+
and restarts, use the same command as above but without `-b` flag.
132134

133135

134136
### 3. Accessing the services
@@ -275,6 +277,9 @@ mlflow logging. You can literally just add a `#` to the
275277
the files, empty files have 0 bytes of content and that
276278
creates issues with the urllib3 upload to S3 (this
277279
happens inside MLFlow)
280+
- If there are any errors in using the Minikube manager, try restarting it
281+
by `python minikube_manager.py --restart` followed by
282+
`python mlops_manager.py --restart` to make sure that the changes are synced.
278283

279284

280285

docs/prod.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,28 @@ per project by any team member of that project)
173173
- Make sure you change the `task_factory` mode to `prod`.
174174
- Contact the CDR maintainers and ask them to add your repository as a
175175
`submodule` (They will know what to do!)
176+
- Create a `PYPI_API_TOKEN` from the PyPi website and add it as a secret to the
177+
repository.
178+
- Do the same with `CODECOV_TOKEN` from the CodeCov website.
179+
- Create a Personal Access Token from your account (make sure your account is a
180+
member of the bcdev org for this to work).
176181

177-
- Create a Personal Access Token from your account (make sure your account is a
178-
member of the bcdev org for this to work).
179-
180-
Do as follows:
182+
Do as follows:
181183

182-
- Go to your Github account Settings
183-
- Navigate to `<> Developer Settings` (the last button on the page)
184-
- Create a `Personal access token (classic)`
185-
- See the image below for reference:
184+
- Go to your Github account Settings
185+
- Navigate to `<> Developer Settings` (the last button on the page)
186+
- Create a `Personal access token (classic)`
187+
- See the image below for reference:
186188

187-
- Only click on the `repo` permissions
188-
- Create the token
189-
- Copy and keep it safe somewhere (maybe on KeePassXC)
190-
- Now, navigate to your newly created project, create a new Secret
191-
- Go to Repository settings
192-
- Navigate to `Secrets and Variables -> Actions -> New repository secret`
193-
- In the `Name` field, insert `CDR_PAT`
194-
- In the `Secret` field, insert your token that generated a few moments ago
195-
- Click on `Add Secret`
189+
- Only click on the `repo` permissions
190+
- Create the token
191+
- Copy and keep it safe somewhere (maybe on KeePassXC)
192+
- Now, navigate to your newly created project, create a new Secret
193+
- Go to Repository settings
194+
- Navigate to `Secrets and Variables -> Actions -> New repository secret`
195+
- In the `Name` field, insert `CDR_PAT`
196+
- In the `Secret` field, insert your token that generated a few moments ago
197+
- Click on `Add Secret`
196198

197199
- Now you are ready to deploy your dags to the production Airflow.
198200

env.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/test_cookiecutter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"minikube_manager.py",
2424
"kube_config_inline",
2525
"utils.py",
26-
"docker_config.py",
26+
"docker_image_name_generator.py",
2727
"docker-compose.yml",
2828
"README.md",
2929
".env",

{{ cookiecutter.folder_name }}/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@ POSTGRES_AIRFLOW_DB=airflow
5252

5353
J_MLFLOW_TRACKING_URI="http://localhost:5000"
5454
J_MLFLOW_S3_ENDPOINT_URL="http://localhost:9000"
55+
56+

{{ cookiecutter.folder_name }}/.github/workflows/publish.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,26 @@ jobs:
1717
- name: checkout
1818
uses: actions/checkout@v4
1919
{% raw %}
20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v3
20+
- name: Set up MicroMamba and install dependencies with Python ${{ matrix.python-version }}
21+
uses: mamba-org/setup-micromamba@v1
2222
with:
23-
python-version: ${{ matrix.python-version }}
23+
environment-file: environment.yml
24+
create-args: >-
25+
python=${{ matrix.python-version }}
2426
{% endraw %}
25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install .[dev,lint,test]
29-
3027
- name: Lint with ruff
3128
run: |
3229
ruff check
3330
31+
- name: Run unit tests
32+
shell: bash -l {0}
33+
run:
34+
pytest test/ --cov=xcube_gedidb --cov-report=xml
35+
3436
- name: Run unit tests
3537
shell: bash -l {0}
3638
run: |
37-
pytest --cov={{ cookiecutter.package_name }} --cov-branch --cov-report=xml
39+
pytest -m "not gaiaflow" --cov={{ cookiecutter.package_name }} --cov-branch --cov-report=xml
3840
3941
- name: Upload coverage reports to Codecov
4042
uses: codecov/codecov-action@v4

{{ cookiecutter.folder_name }}/.github/workflows/unittest.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,27 @@ jobs:
1616
steps:
1717
- name: checkout
1818
uses: actions/checkout@v4
19-
{% raw %}
20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v3
19+
{% raw %}
20+
- name: Set up MicroMamba and install dependencies with Python ${{ matrix.python-version }}
21+
uses: mamba-org/setup-micromamba@v1
2222
with:
23-
python-version: ${{ matrix.python-version }}
23+
environment-file: environment.yml
24+
create-args: >-
25+
python=${{ matrix.python-version }}
2426
{% endraw %}
25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install .[dev,lint,test]
29-
3027
- name: Lint with ruff
3128
run: |
3229
ruff check
3330
31+
- name: Run unit tests
32+
shell: bash -l {0}
33+
run:
34+
pytest test/ --cov=xcube_gedidb --cov-report=xml
35+
3436
- name: Run unit tests
3537
shell: bash -l {0}
3638
run: |
37-
pytest --cov={{ cookiecutter.package_name }} --cov-branch --cov-report=xml
39+
pytest -m "not gaiaflow" --cov={{ cookiecutter.package_name }} --cov-branch --cov-report=xml
3840
3941
- name: Upload coverage reports to Codecov
4042
uses: codecov/codecov-action@v4

{{ cookiecutter.folder_name }}/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Add License Badge
1313

1414
{{ cookiecutter.project_name|capitalize }}
1515

16-
Please have a look at the documentation to get started!
16+
Please have a look at the [documentation](https://bcdev.github.io/gaiaflow/getting_started/) to get started!
1717
Feel free to update this README as your own.
1818

1919
To add a license, please choose which license you want for your project
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[core]
2+
dags_folder = ./dags
3+
load_examples = False

0 commit comments

Comments
 (0)