Skip to content

Commit

Permalink
fix(nwp): Typing for asset materializations (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc authored Jan 27, 2025
1 parent cc15b5b commit 566150b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 29 deletions.
21 changes: 10 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dev = [
"unittest-xml-reporting",
"dagit",
# Linting
"ruff",
"ruff>=0.9.2",
"types-pyyaml",
"types-pytz",
"types-requests",
Expand All @@ -57,6 +57,13 @@ enabled = true
# Ruff configuration
# * See https://beta.ruff.rs/docs/
[tool.ruff]
line-length = 100
indent-width = 4
# Use pydocstyle Google convention
# See https://www.pydocstyle.org/en/stable/error_codes.html
exclude = ["__init__.py"]

[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle
Expand All @@ -77,26 +84,18 @@ select = [
"D", # pydocstyle
"RUF", # ruff-specific rules
]
line-length = 100
indent-width = 4
# Use pydocstyle Google convention
# See https://www.pydocstyle.org/en/stable/error_codes.html
fixable = ["ALL"]
ignore = [
"D203", "D213", "D215", "D400", "D401", "D404", "D406",
"D407", "D408", "D409", "D413",
"ANN101",
]
exclude = ["__init__.py"]
fixable = ["ALL"]
per-file-ignores = {"test*" = ["D", "ANN"]}

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"

[tool.ruff.per-file-ignores]
"test*" = ["D", "ANN"]

# MyPy configuration
# * See https://mypy.readthedocs.io/en/stable/index.html
[tool.mypy]
Expand Down
6 changes: 3 additions & 3 deletions src/dagster_dags/assets/nwp/ceda_mo_um_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

import os
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import dagster as dg
from dagster_docker import PipesDockerClient
Expand Down Expand Up @@ -53,7 +53,7 @@
def ceda_mo_um_global_asset(
context: dg.AssetExecutionContext,
pipes_docker_client: PipesDockerClient,
) -> Any: # noqa: ANN401
) -> dg.MaterializeResult:
"""Dagster asset for MO Unified Model global NWP data from CEDA."""
it: dt.datetime = context.partition_time_window.start
return pipes_docker_client.run(
Expand All @@ -73,5 +73,5 @@ def ceda_mo_um_global_asset(
"nano_cpus": 4e9,
},
context=context,
).get_results()
).get_materialize_result()

6 changes: 3 additions & 3 deletions src/dagster_dags/assets/nwp/ecmwf_ens_stat_india.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import os
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import dagster as dg
from dagster_docker import PipesDockerClient
Expand Down Expand Up @@ -55,7 +55,7 @@
def ecmwf_ens_stat_india_asset(
context: dg.AssetExecutionContext,
pipes_docker_client: PipesDockerClient,
) -> Any: # noqa: ANN401
) -> dg.MaterializeResult:
"""Dagster asset downloading ECMWF ENS data for India."""
it: dt.datetime = context.partition_time_window.start
return pipes_docker_client.run(
Expand All @@ -77,5 +77,5 @@ def ecmwf_ens_stat_india_asset(
"nano_cpus": 4e9,
},
context=context,
).get_results()
).get_materialize_result()

6 changes: 3 additions & 3 deletions src/dagster_dags/assets/nwp/ecmwf_hres_ifs_india.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

import os
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import dagster as dg
from dagster_docker import PipesDockerClient
Expand Down Expand Up @@ -54,7 +54,7 @@
def ecmwf_hres_ifs_india_asset(
context: dg.AssetExecutionContext,
pipes_docker_client: PipesDockerClient,
) -> Any: # noqa: ANN401
) -> dg.MaterializeResult:
"""Dagster asset for HRES IFS model data covering India from ECMWF."""
it: dt.datetime = context.partition_time_window.start
return pipes_docker_client.run(
Expand All @@ -76,5 +76,5 @@ def ecmwf_hres_ifs_india_asset(
"nano_cpus": 4e9,
},
context=context,
).get_results()
).get_materialize_result()

6 changes: 3 additions & 3 deletions src/dagster_dags/assets/nwp/ecmwf_hres_ifs_west_europe.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

import os
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import dagster as dg
from dagster_docker import PipesDockerClient
Expand Down Expand Up @@ -54,7 +54,7 @@
def ecmwf_hres_ifs_west_europe_asset(
context: dg.AssetExecutionContext,
pipes_docker_client: PipesDockerClient,
) -> Any: # noqa: ANN401
) -> dg.MaterializeResult:
"""Dagster asset for HRES IFS NWP data covering Western Europe from ECMWF."""
it: dt.datetime = context.partition_time_window.start
return pipes_docker_client.run(
Expand All @@ -76,5 +76,5 @@ def ecmwf_hres_ifs_west_europe_asset(
"nano_cpus": 4e9,
},
context=context,
).get_results()
).get_materialize_result()

6 changes: 3 additions & 3 deletions src/dagster_dags/assets/nwp/noaa-gfs-global.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import os
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import dagster as dg
from dagster_docker import PipesDockerClient
Expand Down Expand Up @@ -54,7 +54,7 @@
def ncep_gfs_global_asset(
context: dg.AssetExecutionContext,
pipes_docker_client: PipesDockerClient,
) -> Any: # noqa: ANN401
) -> dg.MaterializeResult:
"""Dagster asset for NCEP GFS global forecast model data."""
it: dt.datetime = context.partition_time_window.start
return pipes_docker_client.run(
Expand All @@ -72,5 +72,5 @@ def ncep_gfs_global_asset(
"nano_cpus": 4e9,
},
context=context,
).get_results()
).get_materialize_result()

6 changes: 3 additions & 3 deletions src/dagster_dags/assets/sat/eumetsat_iodc_lrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import os
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import dagster as dg
from dagster_docker import PipesDockerClient
Expand Down Expand Up @@ -48,7 +48,7 @@
def eumetsat_seviri_lrv_asset(
context: dg.AssetExecutionContext,
pipes_docker_client: PipesDockerClient,
) -> Any: # noqa: ANN401
) -> dg.MaterializeResult:
"""Dagster asset for EUMETSAT's RSS service, low resolution."""
it: dt.datetime = context.partition_time_window.start
return pipes_docker_client.run(
Expand All @@ -58,5 +58,5 @@ def eumetsat_seviri_lrv_asset(
"volumes": [f"{ARCHIVE_FOLDER}:/work"],
},
context=context,
).get_results()
).get_materialize_result()

0 comments on commit 566150b

Please sign in to comment.