Skip to content

Commit

Permalink
add ecs task and dag for neso foreacst (#759)
Browse files Browse the repository at this point in the history
* add ecs task and dag for neso foreacst

* update version

* update docs
  • Loading branch information
peterdudfield authored Jan 30, 2025
1 parent 30f1298 commit 214a0f6
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,39 @@
)

latest_only >> national_forecast >> forecast_blend



with DAG(
f"{region}-neso-forecast",
schedule_interval="0 * * * *",
default_args=default_args,
concurrency=10,
max_active_tasks=10,
) as dag:
dag.doc_md = "Get NESO Solar forecast"

latest_only = LatestOnlyOperator(task_id="latest_only")

neso_forecast = EcsRunTaskOperator(
task_id=f"{region}-neso-forecast",
task_definition="neso-forecast",
cluster=cluster,
overrides={},
launch_type="FARGATE",
network_configuration={
"awsvpcConfiguration": {
"subnets": [subnet],
"securityGroups": [security_group],
"assignPublicIp": "ENABLED",
},
},
task_concurrency=10,
on_failure_callback=on_failure_callback,
awslogs_group="/aws/ecs/consume/neso-forecast",
awslogs_stream_prefix="streaming/neso-forecast-consume",
awslogs_region="eu-west-1",
)


latest_only >> neso_forecast
32 changes: 32 additions & 0 deletions terraform/nowcasting/development/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The componentes ares:
3.7 - PVLive Consumer (From PVLive)
3.8 - PVLive Consumer - GSP Day After
3.9 - PVLive Consumer - National Day After
3.10 - NESO Forecast Consumer
4.1 - Metrics
4.2 - Forecast PVnet 1
4.3 - Forecast National XG
Expand Down Expand Up @@ -472,6 +473,37 @@ module "gsp-consumer-day-after-national" {
container-command = []
}

# 3.10
module "neso-forecast-consumer" {
source = "../../modules/services/ecs_task"

ecs-task_name = "neso-forecast"
ecs-task_type = "consumer"
ecs-task_execution_role_arn = module.ecs.ecs_task_execution_role_arn
ecs-task_size = {
cpu = 256
memory = 512
}

aws-region = var.region
aws-environment = local.environment

s3-buckets = []

container-env_vars = [
{ "name" : "SENTRY_DSN", "value" : var.sentry_dsn },
{ "name" : "ENVIRONMENT", "value" : local.environment },
]
container-secret_vars = [
{secret_policy_arn: module.database.forecast-database-secret.arn,
values: ["DB_URL"]}
]
container-tag = var.neso_forecast_consumer_version
container-name = "openclimatefix/neso_solar_consumer_api"
container-registry = "docker.io"
container-command = []
}

# 4.1
module "metrics" {
source = "../../modules/services/ecs_task"
Expand Down
6 changes: 6 additions & 0 deletions terraform/nowcasting/development/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@ variable "sentry_dsn_api" {
description = "The Sentry DSN for all backend components"
default = ""
}

variable "neso_forecast_consumer_version" {
type = string
description = "The version of the neso forecast consumer"
default = "1.0.3"
}

0 comments on commit 214a0f6

Please sign in to comment.