Skip to content

Conversation

iamsgarg-ob
Copy link
Contributor

@iamsgarg-ob iamsgarg-ob commented Oct 8, 2025

when capturing the error from argo workflows - there are situations when the template failure is due to errors which do not include the finishedAt Property.

   {
      "displayName":"hellocloudflow-8hfkz",
      "message":"",
      "templateName":"HelloCloudFlow",
      "phase":"Failed",
      "podName":"hellocloudflow-8hfkz",
      "finishedAt":"2025-10-08T22:28:10Z"
   },
   {
      "displayName":"start",
      "message":"Missing labels used as nodeSelectors",
      "templateName":"start",
      "phase":"Failed",
      "podName":"hellocloudflow-8hfkz-start-4218075540",
      "finishedAt":null
   }
]

In such a situation we end up with:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/metaflow/.mf_code/metaflow/plugins/argo/capture_error.py", line 69, in <module>
    first_err = determine_first_error()
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/metaflow/.mf_code/metaflow/plugins/argo/capture_error.py", line 55, in determine_first_error
    group.sort(
  File "/metaflow/.mf_code/metaflow/plugins/argo/capture_error.py", line 56, in <lambda>
    key=lambda x: datetime.strptime(x["finishedAt"], "%Y-%m-%dT%H:%M:%SZ")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: strptime() argument 1 must be str, not None
time="2025-10-08T14:23:18 UTC" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 1

This PR fixes that.

saikonen
saikonen previously approved these changes Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants