Argo Workflows是一個Kubernetes原生的工作流程引擎,支援通過YAML或Python SDK編排並行任務,簡化容器化應用的自動化和管理工作。Argo Workflows適用於需要處理多步驟、並行任務和依賴關係的情境,例如資料處理、機器學習Pipeline、模擬計算、CI/CD流水線等。本文通過樣本應用帶您體驗如何使用Argo CLI建立一個工作流程。
前提條件
已參見啟用批量任務編排能力完成組件的安裝和阿里雲Argo CLI的安裝。
操作步驟
參見以下內容,建立helloworld-workflow.yaml,提交樣本工作流程工作。
apiVersion: argoproj.io/v1alpha1 kind: Workflow # new type of k8s spec. metadata: generateName: hello-world- # name of the workflow spec. spec: entrypoint: main # invoke the main template. templates: - name: main # name of the template. container: image: mirrors-ssl.aliyuncs.com/busybox:latest command: [ echo ] args: [ "hello world" ]執行以下命令,提交工作流程。
argo submit helloworld-workflow.yaml -n argo查看工作流程狀態。
執行以下命令,擷取工作流程列表。
argo list -n argo預期輸出:
NAME STATUS AGE DURATION PRIORITY hello-world-XXXXX Succeeded 2m 37s 0預期輸出表明,工作流程已經完成。
執行以下命令,查看工作流程狀態。
argo get hello-world-XXXXX -n argo預期輸出:
Name: hello-world-XXXXX Namespace: argo ServiceAccount: unset (will run with the default ServiceAccount) Status: Succeeded Conditions: PodRunning False Completed True .... Duration: 37 seconds Progress: 1/1 ResourcesDuration: 17s*(1 cpu),17s*(100Mi memory) STEP TEMPLATE PODNAME DURATION MESSAGE ✔ hello-world-XXXXX whalesay hello-world-XXXXX 27s預期輸出同樣表明,工作流程已經完成。
相關文檔
工作流程的相關資源會被定期清理,如需將工作流程持久化儲存到資料庫中,請參見持久化工作流程。