Skip to content

Commit 995a0c4

Browse files
committed
add ecs task and dag for neso foreacst
1 parent 30f1298 commit 995a0c4

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

terraform/modules/services/airflow/dags/uk/forecast-national-dag.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,39 @@
7979
)
8080

8181
latest_only >> national_forecast >> forecast_blend
82+
83+
84+
85+
with DAG(
86+
f"{region}-neso-forecast",
87+
schedule_interval="0 * * * *",
88+
default_args=default_args,
89+
concurrency=10,
90+
max_active_tasks=10,
91+
) as dag:
92+
dag.doc_md = "Get PV data"
93+
94+
latest_only = LatestOnlyOperator(task_id="latest_only")
95+
96+
neso_forecast = EcsRunTaskOperator(
97+
task_id=f"{region}-neso-forecast",
98+
task_definition="neso-forecast",
99+
cluster=cluster,
100+
overrides={},
101+
launch_type="FARGATE",
102+
network_configuration={
103+
"awsvpcConfiguration": {
104+
"subnets": [subnet],
105+
"securityGroups": [security_group],
106+
"assignPublicIp": "ENABLED",
107+
},
108+
},
109+
task_concurrency=10,
110+
on_failure_callback=on_failure_callback,
111+
awslogs_group="/aws/ecs/consume/neso-forecast",
112+
awslogs_stream_prefix="streaming/neso-forecast-consume",
113+
awslogs_region="eu-west-1",
114+
)
115+
116+
117+
latest_only >> neso_forecast

terraform/nowcasting/development/main.tf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The componentes ares:
2121
3.7 - PVLive Consumer (From PVLive)
2222
3.8 - PVLive Consumer - GSP Day After
2323
3.9 - PVLive Consumer - National Day After
24+
3.10 - NESO Forecast Consumer
2425
4.1 - Metrics
2526
4.2 - Forecast PVnet 1
2627
4.3 - Forecast National XG
@@ -472,6 +473,37 @@ module "gsp-consumer-day-after-national" {
472473
container-command = []
473474
}
474475

476+
# 3.10
477+
module "neso-forecast-consumer" {
478+
source = "../../modules/services/ecs_task"
479+
480+
ecs-task_name = "neso-forecast"
481+
ecs-task_type = "consumer"
482+
ecs-task_execution_role_arn = module.ecs.ecs_task_execution_role_arn
483+
ecs-task_size = {
484+
cpu = 256
485+
memory = 512
486+
}
487+
488+
aws-region = var.region
489+
aws-environment = local.environment
490+
491+
s3-buckets = []
492+
493+
container-env_vars = [
494+
{ "name" : "SENTRY_DSN", "value" : var.sentry_dsn },
495+
{ "name" : "ENVIRONMENT", "value" : local.environment },
496+
]
497+
container-secret_vars = [
498+
{secret_policy_arn: module.database.forecast-database-secret.arn,
499+
values: ["DB_URL"]}
500+
]
501+
container-tag = var.neso_forecast_consumer_version
502+
container-name = "openclimatefix/neso_solar_consumer_api"
503+
container-registry = "docker.io"
504+
container-command = []
505+
}
506+
475507
# 4.1
476508
module "metrics" {
477509
source = "../../modules/services/ecs_task"

terraform/nowcasting/development/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,9 @@ variable "sentry_dsn_api" {
123123
description = "The Sentry DSN for all backend components"
124124
default = ""
125125
}
126+
127+
variable "neso_forecast_consumer_version" {
128+
type = string
129+
description = "The version of the neso forecast consumer"
130+
default = "1.0.2"
131+
}

0 commit comments

Comments
 (0)