本页面为机器翻译。阅读英文原文。

Recipe

task-ecs

The generic ephemeral compute primitive as an Amazon ECS task on Fargate that an EventBridge Scheduler schedule starts, rendered as a CloudFormation fragment the provider assembles into the boundary's stack. Reach for it where the target is an AWS account with an ECS cluster and a VPC; reach for helm/task on Kubernetes, which also runs a task with no schedule once. A task with no schedule carrying core/manual-trigger is deployed without starting, its task definition alone; the operator starts each run with aws ecs run-task, giving the cluster, task definition and network configuration from infra.overrides. A scheduled task runs on its schedule, attached or not, and can be started that way too. Any other unscheduled task is refused by name, as nothing on AWS starts it. The cron fields become the scheduler's own expression where the two mean the same times, evaluated in UTC unless the Release names a time zone, and are refused by name where they do not, as for a schedule restricting both the day of the month and the day of the week. The cluster, subnets, security groups, execution role and, with a schedule, the scheduler's role come from infra.overrides and are required. Only a task definition and a schedule are emitted: no role, log group or network resource, each of which the operator already runs, and no service, as a run ends. Each env entry an edge or the component's own inject block dictates becomes a container variable; timeout arrives by default as TASK_TIMEOUT, which no edge may dictate while it is the default, for the code to honour, as ECS sets no deadline on a run. File, arg and other entries are refused by name. The task runs at the smallest Fargate size meeting infra.compute.

版本

1.0.01.0.1

来源

官方由本目录认定为官方发布者的签名身份签名。
内容摘要
sha256:2f340a8220d48f316de718eb2c9966b7456d47379e8d0ac2a29affbc689d181e
发布时间
2026-11-15T08:09:04Z
签名身份
https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main

签名

  • 官方application/vnd.dev.sigstore.bundle.v0.3+json

    https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main

    sha256:9cca4eec55f8d711a3a3dd80c9cec58d61c178beb5907f22279ef62482591b4d

此版本的引用

oci://hub.aggrega.ai/recipe/cloudformation/task-ecs:1.0.1
目标
—
实现
core/compute/task:1.0.1

提供

此配方为使用方接入的确定性指针模板。

未声明 provides 模板。

Workload

未声明工作负载模板。

局部变量

名称模板
logical_id{{ capitalizedWords .context.instance_id }}
instance_id{{ .context.instance_id }}
schedule_translation{{- $s := trim (toString (optional .values "schedule" "")) -}} {{- $out := "" -}} {{- if $s -}} {{- $f := regexSplit `\s+` $s -1 -}} {{- $descriptors := dict "@yearly" "0 0 1 1 *" "@annually" "0 0 1 1 *" "@monthly" "0 0 1 * *" "@weekly" "0 0 * * 0" "@daily" "0 0 * * *" "@midnight" "0 0 * * *" "@hourly" "0 * * * *" -}} {{- if and (eq (len $f) 1) (hasKey $descriptors (index $f 0)) -}} {{- $f = regexSplit `\s+` (index $descriptors (index $f 0)) -1 -}} {{- end -}} {{- if hasPrefix "@every" $s -}} {{- $out = "refuse:@every repeats at an interval counted from a moment Kubernetes chooses, which an EventBridge Scheduler schedule cannot reproduce: write the schedule as five cron fields" -}} {{- else if regexMatch `^(CRON_)?TZ=` (index $f 0) -}} {{- $out = "refuse:it names a time zone inside the expression, where an EventBridge Scheduler expression takes none: write the five fields alone, and name the time zone under infra.overrides in the Release" -}} {{- else if ne (len $f) 5 -}} {{- $out = printf "refuse:it has %d fields where a cron expression has five, minute, hour, day of the month, month and day of the week: write the schedule as those five fields" (len $f) -}} {{- else -}} {{- $item := `^(\*|\?|[0-9]+(-[0-9]+)?)(/[0-9]+)? task-ecs 1.0.1 · Aggrega 目录 -}} {{- $min := index $f 0 -}}{{- $hour := index $f 1 -}}{{- $dom := index $f 2 -}} {{- $mon := lower (index $f 3) -}}{{- $dow := lower (index $f 4) -}} {{- range $i, $n := list "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec" }}{{ $mon = replace $n (toString (add1 $i)) $mon }}{{ end -}} {{- range $i, $n := list "sun" "mon" "tue" "wed" "thu" "fri" "sat" }}{{ $dow = replace $n (toString $i) $dow }}{{ end -}} {{- $badField := "" -}}{{- $badValue := "" -}} {{- range $pair := list (list "minute" $min (index $f 0)) (list "hour" $hour (index $f 1)) (list "day-of-month" $dom (index $f 2)) (list "month" $mon (index $f 3)) (list "day-of-week" $dow (index $f 4)) -}} {{- range splitList "," (index $pair 1) -}} {{- if and (not $badField) (not (regexMatch $item .)) }}{{ $badField = index $pair 0 }}{{ $badValue = index $pair 2 }}{{ end -}} {{- end -}} {{- end -}} {{- $domStar := false -}}{{- $dowStar := false -}} {{- range splitList "," $dom }}{{ $p := splitList "/" . }}{{ if and (has (index $p 0) (list "*" "?")) (or (eq (len $p) 1) (le (atoi (index $p 1)) 1)) }}{{ $domStar = true }}{{ end }}{{ end -}} {{- range splitList "," $dow }}{{ $p := splitList "/" . }}{{ if and (has (index $p 0) (list "*" "?")) (or (eq (len $p) 1) (le (atoi (index $p 1)) 1)) }}{{ $dowStar = true }}{{ end }}{{ end -}} {{- $days := list -}}{{- $dowBad := false -}} {{- if not $badField -}} {{- range splitList "," $dow -}} {{- $p := splitList "/" . -}} {{- $step := 1 -}}{{- if eq (len $p) 2 }}{{ $step = atoi (index $p 1) }}{{ end -}} {{- $lo := 0 -}}{{- $hi := 6 -}} {{- if not (has (index $p 0) (list "*" "?")) -}} {{- $lh := splitList "-" (index $p 0) -}} {{- $lo = atoi (index $lh 0) -}} {{- if eq (len $lh) 2 }}{{ $hi = atoi (index $lh 1) }}{{ else if eq (len $p) 1 }}{{ $hi = $lo }}{{ end -}} {{- end -}} {{- if or (gt $hi 6) (gt $lo $hi) (lt $step 1) }}{{ $dowBad = true }}{{ else }}{{ range untilStep $lo (int (add1 $hi)) $step }}{{ $days = append $days (toString (add1 .)) }}{{ end }}{{ end -}} {{- end -}} {{- end -}} {{- if $badField -}} {{- $out = printf "refuse:its %s field %q is not a comma list of numbers, names, ranges, steps or *, the forms Kubernetes and EventBridge Scheduler both read alike: write that field in those forms" $badField $badValue -}} {{- else if $dowBad -}} {{- $out = printf "refuse:its day-of-week field %q names a day outside 0 to 6, Sunday to Saturday, or a range running backwards, which Kubernetes refuses as well: write the days from 0 for Sunday to 6 for Saturday" (index $f 4) -}} {{- else if and (not $domStar) (not $dowStar) -}} {{- $out = "refuse:it restricts both the day of the month and the day of the week, so a run happens on a day matching either, and an EventBridge Scheduler cron expression leaves one of the two unrestricted, so it cannot run on a day matching either: restrict one of the two fields only, and declare a second component for the other" -}} {{- else -}} {{- $domOut := $dom -}}{{- $dowOut := "?" -}} {{- if $domStar }}{{ $domOut = "?" }}{{ $dowOut = join "," (sortAlpha (uniq $days)) }}{{ end -}} {{- if and $domStar $dowStar }}{{ $domOut = "*" }}{{ $dowOut = "?" }}{{ end -}} {{- $out = printf "cron(%s %s %s %s %s *)" (replace "?" "*" $min) (replace "?" "*" $hour) $domOut (replace "?" "*" $mon) $dowOut -}} {{- end -}} {{- end -}} {{- end -}} {{- $out -}}
cpu_millicores{{- $c := toString (optional (optional .infra "compute" dict) "cpu" "") -}} {{- if regexMatch `^[0-9]+m task-ecs 1.0.1 · Aggrega 目录 $c -}}{{ atoi (trimSuffix "m" $c) }} {{- else if regexMatch `^[0-9]+(\.[0-9]{1,3})? task-ecs 1.0.1 · Aggrega 目录 $c -}} {{- $p := splitList "." $c -}}{{- $f := 0 -}} {{- if eq (len $p) 2 }}{{ $f = atoi (substr 0 3 (printf "%s000" (index $p 1))) }}{{ end -}} {{- add (mul (atoi (index $p 0)) 1000) $f -}} {{- end -}}
memory_mib{{- $m := toString (optional (optional .infra "compute" dict) "memory" "") -}} {{- if regexMatch `^[0-9]+Mi task-ecs 1.0.1 · Aggrega 目录 $m -}}{{ atoi (trimSuffix "Mi" $m) }} {{- else if regexMatch `^[0-9]+Gi task-ecs 1.0.1 · Aggrega 目录 $m -}}{{ mul (atoi (trimSuffix "Gi" $m)) 1024 }} {{- end -}}
task_size{{- $found := "" -}} {{- if and .locals.cpu_millicores .locals.memory_mib -}} {{- $mc := atoi .locals.cpu_millicores -}}{{- $mib := atoi .locals.memory_mib -}} {{- range list (list 256 (list 512 1024 2048)) (list 512 (untilStep 1024 4097 1024)) (list 1024 (untilStep 2048 8193 1024)) (list 2048 (untilStep 4096 16385 1024)) (list 4096 (untilStep 8192 30721 1024)) (list 8192 (untilStep 16384 61441 4096)) (list 16384 (untilStep 32768 122881 8192)) (list 32768 (list 61440 122880 249856)) -}} {{- $cpu := index . 0 -}} {{- if and (not $found) (ge (mul $cpu 1000) (mul $mc 1024)) -}} {{- range index . 1 }}{{ if and (not $found) (ge . $mib) }}{{ $found = printf "%d/%d" $cpu . }}{{ end }}{{ end -}} {{- end -}} {{- end -}} {{- end -}} {{- $found -}}
task_cpu{{ if .locals.task_size }}{{ index (splitList "/" .locals.task_size) 0 }}{{ end }}
task_memory{{ if .locals.task_size }}{{ index (splitList "/" .locals.task_size) 1 }}{{ end }}

值映射

未声明值映射。

关系

与其他已发布实体之间的类型化边。没有已发布目标的引用会呈现为断开的边,而不是链接。

使用

被使用

目录中没有任何内容依赖此实体。

Recipe 概念参考 →

Aggrega 目录 — 收录组件、功能、配方以及渲染它们的插件的开放索引。

基于共享的 Aggrega 设计系统构建。

隐私