Skip to content

Commit be04767

Browse files
Ken LippoldKen Lippold
authored andcommitted
Added hydroserverpy ETL task, ETL tests, and ETL migration
1 parent 6b5ee12 commit be04767

28 files changed

+1917
-801
lines changed

api/urls.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,10 @@
4949
api.add_router("processing-levels", processing_level_router)
5050
api.add_router("result-qualifiers", result_qualifier_router)
5151

52-
etl_api = NinjaAPI(
53-
title="HydroServer ETL API",
54-
version=__version__,
55-
urls_namespace="etl",
56-
docs_decorator=ensure_csrf_cookie,
57-
renderer=ORJSONRenderer(),
58-
throttle=[
59-
AnonRateThrottle("20/s"),
60-
AuthRateThrottle("20/s"),
61-
],
62-
)
63-
64-
etl_api.add_router("jobs", job_router)
65-
etl_api.add_router("tasks", task_router)
66-
etl_api.add_router("tasks", task_run_router)
67-
etl_api.add_router("orchestration-systems", orchestration_system_router)
52+
api.add_router("etl-jobs", job_router)
53+
api.add_router("etl-tasks", task_router)
54+
api.add_router("etl-tasks", task_run_router)
55+
api.add_router("etl-orchestration-systems", orchestration_system_router)
6856

6957
st_api_1_1 = SensorThingsAPI(
7058
title="HydroServer SensorThings API",
@@ -81,6 +69,5 @@
8169

8270
urlpatterns = [
8371
path("data/", api.urls),
84-
path("etl/", etl_api.urls),
8572
path("sensorthings/v1.1/", st_api_1_1.urls),
8673
]

etl/management/__init__.py

Whitespace-only changes.

etl/management/commands/__init__.py

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from django.core.management.base import BaseCommand
2+
from django.core.management import call_command
3+
4+
5+
class Command(BaseCommand):
6+
help = "Loads test data from fixtures"
7+
8+
def handle(self, *args, **kwargs):
9+
fixtures = [
10+
"tests/fixtures/test_etl_jobs.yaml",
11+
"tests/fixtures/test_etl_orchestration_systems.yaml",
12+
"tests/fixtures/test_etl_tasks.yaml",
13+
]
14+
15+
for fixture in fixtures:
16+
self.stdout.write(self.style.NOTICE(f"Loading fixture: {fixture}"))
17+
try:
18+
call_command("loaddata", fixture)
19+
self.stdout.write(self.style.SUCCESS(f"Successfully loaded {fixture}"))
20+
except Exception as e:
21+
self.stderr.write(self.style.ERROR(f"Failed to load {fixture}: {e}"))

0 commit comments

Comments
 (0)