apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  annotations:
    pipelines.kubeflow.org/pipeline_spec: '{"description": "Get Most Frequent Word and Save to GCS", "inputs": [{"name": "message", "type": "String"}], "name": "Save Most Frequent"}'
  generateName: save-most-frequent-
spec:
  arguments:
    parameters:
    - name: message
  entrypoint: save-most-frequent
  imagePullSecrets:
  - name: secretA
  serviceAccountName: pipeline-runner
  templates:
  - container:
      args:
      - python -c "from collections import Counter; words = Counter('{{inputs.parameters.message}}'.split());
        print(max(words, key=words.get))" | tee /tmp/message.txt
      command:
      - sh
      - -c
      image: python:3.5-jessie
    inputs:
      parameters:
      - name: message
    name: get-frequent
    outputs:
      artifacts:
      - name: get-frequent-word
        path: /tmp/message.txt
  - dag:
      tasks:
      - arguments:
          parameters:
          - name: message
            value: '{{inputs.parameters.message}}'
        name: get-frequent
        template: get-frequent
    inputs:
      parameters:
      - name: message
    name: save-most-frequent
