简体   繁体   English

如何查看 Argo 中任务的日志?

[英]How do I view the logs from a task in Argo?

I am using Argo and have a question about the workflow of workflows example.我正在使用 Argo 并且对工作流示例的工作流程有疑问。 ( https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-of-workflows.yaml ) ( https://github.com/argoproj/argo-workflows/blob/master/examples/workflow-of-workflows.yaml )

UPDATED YET AGAIN再次更新

As pointed out below, it is a task that I need to view.正如下面所指出的,这是我需要查看的任务。 So my question is now - How do I view the logs from a task?所以我现在的问题是 - 如何查看任务的日志?

My workflow completes without error, but does not produce the expected output.我的工作流程没有错误地完成,但没有产生预期的输出。 I would like to look at the logs of one of the containers within one of the workflows within the overall workflow, but I cannot get the syntax right I am using the following convention to get the logs from the relevant pod.我想查看整个工作流中的一个工作流中的一个容器的日志,但我无法获得正确的语法我正在使用以下约定从相关 pod 获取日志。

argo logs -n argo wf-name pod-name

and getting:并获得:

workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.360917900Z time="2021-04-05T17:55:43.360Z" level=info msg="Starting Workflow Executor" executorType= version="{untagged 2021-04-05T17:09:35Z 79eb50b42e948466f82865b8a79756b57f9b66d9 untagged clean go1.15.7 gc linux/amd64}"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.362737800Z time="2021-04-05T17:55:43.362Z" level=info msg="Creating a docker executor"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.362815200Z time="2021-04-05T17:55:43.362Z" level=info msg="Executor (version: untagged, build_date: 2021-04-05T17:09:35Z) initialized (pod: argo/workflow-of-workflows-k8fm5-3824346685) with template:\n{\"name\":\"run\",\"inputs\":{\"parameters\":[{\"name\":\"runTemplate\",\"value\":\"demo1run.yaml\"}]},\"outputs\":{},\"metadata\":{},\"resource\":{\"action\":\"create\",\"manifest\":\"# Example of using a hard-wired artifact location from a HTTP URL.\\napiVersion: argoproj.io/v1alpha1\\nkind: Workflow\\nmetadata:\\n  generateName: message-passing-1-\\n  namespace: argo\\nspec:\\n  serviceAccountName: argo\\n  entrypoint: entrypoint\\n\\n  templates:\\n\\n  - name: echo\\n    container:\\n      image: weilidma/curl:0.4\\n      command:\\n        - \\\"/bin/bash\\\"\\n        - \\\"-c\\\"\\n      args:\\n        - \\\"cat /mnt/raw/raw1.json  \\u0026\\u0026 exit\\\"\\n      volumeMounts:\\n        - name: raw-p1-vol\\n          mountPath: /mnt/raw\\n        - name: log-p1-vol\\n          mountPath: /mnt/logs/\\n\\n  - name: process1\\n    container:\\n      image: weilidma/curl:0.4\\n      command: \\n        - \\\"/bin/bash\\\"\\n        - \\\"-c\\\"\\n      args: \\n        - \\\"jq \\\\u0027[.data[].Platform |= test(\\\\u0022Healy\\\\u0022) | .[][] | select(.Platform == true) | {survey: .Survey, url: .\\\\u0022Data Access\\\\u0022}]\\\\u0027 /mnt/raw/raw1.json \\u003e /mnt/processed/filtered1.json \\u0026\\u0026 exit\\\"\\n      volumeMounts:\\n        - name: raw-p1-vol\\n          mountPath: /mnt/raw/\\n        - name: processed-p1-vol\\n          mountPath: /mnt/processed/\\n        - name: log-p1-vol\\n          mountPath: /mnt/logs/\\n\\n  - name: process2\\n    container:\\n      image: weilidma/curl:0.4\\n      command: \\n        - \\\"/bin/bash\\\"\\n        - \\\"-c\\\"\\n      args: \\n        - \\\"jq \\\\u0027[.data[].Platform |= test(\\\\u0022Healy\\\\u0022) | .[][] | select(.Platform == true) | {survey: .Survey, url: .\\\\u0022Data Access\\\\u0022}]\\\\u0027 /mnt/raw/raw2.json \\u003e /mnt/processed/filtered2.json \\u0026\\u0026 exit\\\"\\n      volumeMounts:\\n        - name: raw-p2-vol\\n          mountPath: /mnt/raw/\\n        - name: processed-p2-vol\\n          mountPath: /mnt/processed/\\n        - name: log-p2-vol\\n          mountPath: /mnt/logs/\\n\\n  - name: join\\n    container:\\n      image: weilidma/curl:0.4\\n      command: \\n        - \\\"/bin/bash\\\"\\n        - \\\"-c\\\"\\n      args: \\n        - \\\"jq -n --slurpfile f1 /mnt/processed1/filtered1.json --slurpfile f2 /mnt/processed2/filtered2.json -f .jq/join.jq --arg field \\\\u0022survey\\\\u0022 \\u003e /mnt/processed1/output.json \\u0026\\u0026 exit\\\"\\n      volumeMounts:\\n        - name: processed-p1-vol\\n          mountPath: /mnt/processed1/\\n        - name: processed-p2-vol\\n          mountPath: /mnt/processed2/\\n        - name: log-p1-vol\\n          mountPath: /mnt/logs1/\\n        - name: log-p2-vol\\n          mountPath: /mnt/logs2/\\n\\n  - name: egress\\n    inputs:\\n      parameters:\\n      - name: ipaddr\\n    container:\\n      image: weilidma/curl:0.4\\n      command: \\n        - \\\"/bin/bash\\\"\\n        - \\\"-c\\\"\\n      args: \\n        - \\\"cat /mnt/processed/output.json \\u0026\\u0026 exit\\\"\\n      volumeMounts:\\n        - name: processed-p1-vol\\n          mountPath: /mnt/processed/\\n        - name: log-p1-vol\\n          mountPath: /mnt/logs/\\n\\n  - dag:\\n      tasks:\\n      - name: echo\\n        template: echo\\n        dependencies:\\n      - name: p1\\n        template: process1\\n        dependencies:\\n\\n      - name: p2\\n        template: process2\\n        dependencies:\\n\\n      - name: j\\n        template: join\\n        dependencies:\\n        - p1\\n        - p2\\n\\n      - name: e\\n        template: egress\\n        arguments:\\n          parameters: \\n            - name: ipaddr \\n              value: 'https://192.241.129.100'\\n        dependencies:\\n        - j\\n\\n    name: entrypoint\\n\"}}"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.362847900Z time="2021-04-05T17:55:43.362Z" level=info msg="Loading manifest to /tmp/manifest.yaml"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.362942100Z time="2021-04-05T17:55:43.362Z" level=info msg="kubectl create -f /tmp/manifest.yaml -o json"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.837625500Z time="2021-04-05T17:55:43.837Z" level=info msg="Resource: argo/Workflow.argoproj.io/message-passing-1-t8749. SelfLink: /apis/argoproj.io/v1alpha1/namespaces/argo/workflows/message-passing-1-t8749"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.837636900Z time="2021-04-05T17:55:43.837Z" level=info msg="Starting SIGUSR2 signal monitor"
workflow-of-workflows-k8fm5-3824346685: 2021-04-05T17:55:43.837696900Z time="2021-04-05T17:55:43.837Z" level=info msg="No output parameters"

Based on this output, the container name seems to be argo/Workflow.argoproj.io/message-passing-1-t8749 but when I add that to the end I get an error.根据此输出,容器名称似乎是 argo/Workflow.argoproj.io/message-passing-1-t8749,但是当我将其添加到最后时,我收到错误消息。 Here are the commands I have tried:以下是我尝试过的命令:

argo logs -n argo workflow-of-workflows-k8fm5 workflow-of-workflows-k8fm5-3824346685 -c argo/Workflow.argoproj.io/message-passing-1-t8749

or要么

argo logs -n argo workflow-of-workflows-k8fm5 workflow-of-workflows-k8fm5-3824346685 -c message-passing-1-t8749

The default container names on an Argo Workflows pod are init , main , and wait . Argo Workflows pod 上的默认容器名称是initmainwait

I'm not sure what message-passing-1-t8749 refers to, but it might be the "step/task name."我不确定message-passing-1-t8749指的是什么,但它可能是“步骤/任务名称”。

Thanks to Alex of ArgoProj!感谢 ArgoProj 的 Alex!

Here is a command I did not know:这是一个我不知道的命令:

kubectl get workflow kubectl 获取工作流程

will list (surprise) workflows!将列出(惊喜)工作流程! From there, I could see the individual workflows embedded into the larger workflow.从那里,我可以看到嵌入到更大工作流程中的各个工作流程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM