-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
173 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Python CI | ||
|
||
on: | ||
push: | ||
branches: [] | ||
paths-ignore: | ||
- 'README.md' | ||
pull_request: | ||
branches: [] | ||
paths-ignore: | ||
- 'README.md' | ||
|
||
# Specify concurrency such that only one workflow can run at a time | ||
# * Different workflow files are not affected | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Define a dependencies job that runs on all branches and PRs | ||
# * Installs dependencies and caches them | ||
build-venv: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Restore cached virtualenv, if available | ||
# * The pyproject.toml hash is part of the cache key, invalidating | ||
# the cache if the file changes | ||
- name: Restore cached virtualenv | ||
id: restore-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ./venv | ||
key: ${{ runner.os }}-venv-${{ hashFiles('**/pyproject.toml') }} | ||
|
||
# Should mirror the build-venv stage in the Containerfile | ||
- name: Build venv | ||
run: | | ||
apt -qq update && apt -qq install -y build-essential | ||
python -m venv ./venv | ||
./venv/bin/pip install --upgrade -q pip wheel setuptools | ||
if: steps.restore-cache.outputs.cache-hit != 'true' | ||
|
||
# Should mirror the build-reqs stage in the Containerfile | ||
# * Except this installs the dev dependencies and binaries as well | ||
- name: Install all dependencies | ||
run: | | ||
./venv/bin/pip install -q .[dev] | ||
if: steps.restore-cache.outputs.cache-hit != 'true' | ||
|
||
# Cache the virtualenv for future runs | ||
- name: Cache virtualenv | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: ./venv | ||
key: ${{ steps.restore-cache.outputs.cache-primary-key }} | ||
if: steps.restore-cache.outputs.cache-hit != 'true' | ||
|
||
# Define a unittest job that runs on all branches and PRs | ||
test-unit: | ||
runs-on: ubuntu-latest | ||
needs: build-venv | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Restore cached virtualenv | ||
- name: Restore cached virtualenv | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ./venv | ||
key: ${{ runner.os }}-venv-${{ hashFiles('**/pyproject.toml') }} | ||
|
||
# Run unittests | ||
# * Produce JUnit XML report | ||
- name: Run unit tests | ||
run: ./venv/bin/python -m pytest --junitxml=ut-report.xml dags_tests | ||
|
||
# Create test summary to be visualised on the job summary screen on GitHub | ||
# * Runs even if previous steps fail | ||
- name: Create test summary | ||
uses: test-summary/action@v2 | ||
with: | ||
paths: "*t-report.xml" | ||
show: "fail, skip" | ||
if: always() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from dagster import Definitions, load_assets_from_modules | ||
from nwp import assets, jobs | ||
|
||
def test_compiles(): | ||
all_assets = load_assets_from_modules([assets]) | ||
defs = Definitions( | ||
assets=all_assets, | ||
jobs=jobs.asset_jobs, | ||
schedules=jobs.schedule_jobs | ||
) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from nwp.assets.dwd.archive_to_hf import download_model_files, process_model_files, upload_model_files_to_hf | ||
from nwp.assets.ecmwf.mars import download_mars_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
from dagster import Output, asset | ||
from ecmwfapi import ECMWFService | ||
|
||
server = ECMWFService("mars") | ||
|
||
|
||
@asset | ||
def download_mars_file(): | ||
server.execute( | ||
req={ | ||
"class": "od", | ||
"date": "20230815/to/20230816", | ||
"expver": "1", | ||
"levtype": "sfc", | ||
"param": "28.228/49.128/123.128/165.128/166.128/239.228/246.228/247.228", | ||
"step": "0/t0/48/by/1", | ||
"stream": "oper", | ||
"time": "00:00:00,12:00:00", | ||
"type": "fc", | ||
}, | ||
target="20230815.grib" | ||
) | ||
|
||
return Output(None, metadata={"filepath": "20230815.grib"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
import json | ||
|
||
import pandas as pd | ||
import requests | ||
|
||
from dagster import AssetExecutionContext, MetadataValue, asset | ||
|
||
|