I am trying to access the content(json data) of a file which is passed as input artifacts to a script template. It is failing with the following error NameError: name 'inputs' is not defined. Did you mean: 'input'?
My artifacts are being stored in aws s3 bucket. I've also tried using environment variables instead of directly referring the artifacts directly in script template, but it is also not working.
Here is my workflow
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: output-artifact-s3-
spec:
entrypoint: main
templates:
- name: main
dag:
tasks:
- name: whalesay-script-template
template: whalesay
- name: retrieve-output-template
dependencies: [whalesay-script-template]
arguments:
artifacts:
- name: result
from: "{{tasks.whalesay-script-template.outputs.artifacts.message}}"
template: retrieve-output
- name: whalesay
script:
image: python
command: [python]
env:
- name: OUTDATA
value: |
{
"lb_url" : "<>.us-east-1.elb.amazonaws.com",
"vpc_id" : "<vpc-id",
"web_server_count" : "4"
}
source: |
import json
import os
OUTDATA = json.loads(os.environ["OUTDATA"])
with open('/tmp/templates_lst.txt', 'w') as outfile:
outfile.write(str(json.dumps(OUTDATA)))
volumeMounts:
- name: out
mountPath: /tmp
volumes:
- name: out
emptyDir: { }
outputs:
artifacts:
- name: message
path: /tmp
- name: retrieve-output
inputs:
artifacts:
- name: result
path: /tmp
script:
image: python
command: [python]
source: |
import json
result = {{inputs.artifacts.result}}
with open(result, 'r') as outfile:
lines = outfile.read()
print(lines)
print('Execution completed')
What's wrong in this workflow?