Skip to content

Remediation to the function of .wait() #696

@rherriott

Description

@rherriott

Which project are you reporting a bug for?

kr8s

What happened?

Often, when I use .wait() (typically async_wait), I'm effectively waiting on "being ready".
For example, I can create a Pod, wait on that pod being ready via 'condition=Ready'

This currently does not reliably work, and gets worse when I'm waiting on something like '.status.readyToUse'.

As a result, I'm stuck either while-try-looping around each .wait(), or manufacturing it myself via

while 'a' not in object or 'b' not in object.a  or object.a.b != value:
    await asyncio.sleep(3.0)
    await object.async_refresh()

As .wait() throws an error when '.status' doesn't exist, or when .readyToUse doesn't exist in '.status'.

I can see having some sort of option to turn on failing if there's no value present in the jsonpath case, but the default usage of .wait() being 'no '.status'? exception.' is nonsensical.

The quickest solution is to edit the line in _objects.py -> APIObject._test_conditions() that calls jsonpath.findall to catch the absence at least of .status

Also, the docs don't mention jsonpath existing in wait()

Thanks!
It's really a good bit of software, that's why I use it so much after all 👍 👍

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions