-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
memoize-simple.yaml
38 lines (38 loc) · 1.26 KB
/
memoize-simple.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# This example demonstrates the ability to memoize a template.
# Cache can be configured in configmap. For example, if the cache
# ConfigMap looks like the following, then you should expect the node output
# retrieved from the cache to be "different world".
# Note that you also need to update `creationTimestamp` in
# `data.hello` to be within the `memoize.maxAge` if `maxAge` is specified in the workflow spec.
#
# apiVersion: v1
# data:
# cache-key: '{"nodeID":"memoized-hdckj","outputs":{"parameters":[{"name":"hello","value":"different world","valueFrom":{"path":"/tmp/hello_world.txt"}}],"exitCode":"0"},"creationTimestamp":"2021-10-12T15:14:04Z","lastHitTimestamp":"2021-10-12T15:14:04Z"}'
# kind: ConfigMap
# metadata:
# creationTimestamp: "2021-10-12T15:14:04Z"
# name: cache-config
#---
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: memoized-
spec:
entrypoint: world-to-file
templates:
- name: world-to-file
memoize:
key: "cache-key"
maxAge: "10s"
cache:
configMap:
name: cache-config
container:
image: busybox
command: [sh, -c]
args: ["echo world > /tmp/hello_world.txt"]
outputs:
parameters:
- name: hello
valueFrom:
path: /tmp/hello_world.txt