Skip to content

oc build-logs should print a list of recent builds if you don't pass an argument #3359

Closed

Description

@smarterclayton

A user who sees oc build-logs in the help may get there before understanding how to list builds - if the user omits the build log we should print a list in the error of existing builds (a reasonable number) if we can.

Today:

$ oc build-logs
error: A build name is required
see 'oc build-logs -h' for help.

Better:

$ oc build-logs
error: A build name is required. Recent builds:
* other-build-2  Running  1 min ago
* ruby-build-1   Failed   5 min ago

If the call to get the build names fails we should simply print the current error (not an error about being unable to find builds). We shouldn't wait for longer than a few hundred milliseconds either before returning.

Activity

  1. bparees commented on Jul 7, 2015

    @bparees
    Contributor

    @gabemontero i don't think you've started on this, if you have let me know and we can revisit reassigning it to @rhcarvalho

  2. gabemontero commented on Jul 7, 2015

    @gabemontero
    Contributor

    No, I have not started in earnest. Just reviewing the issue description and some experimentation in earnest.

  3. added 2 commits that reference this issue on Jul 24, 2015
    09fa6c7
    159c06d
  4. rhcarvalho commented on Aug 5, 2015

    @rhcarvalho
    Contributor

    Introducing a timeout here brought up a challenge to testing and determining what the timeout should be.

    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1250292

    Seems that this was the first instance of a CLI error condition that makes a REST API call to fetch data to be presented as part of the error message.

    Talked with @mfojtik and got some ideas about alternative implementations:

    • Write message about missing argument to stderr ASAP, and then print "fetching existing builds" with or without timeout (user can "ctrl-c" to ignore fetching builds).

      Challenge: if we go this way, we'll end up duplicating error handling code from Kube (specifically, appending "error: " to the message and later printing the rest of the error message working around the existing code mechanics)

    • Instead of listing builds in the error message (or if fetching builds times out), teach how to do it:
      oc get builds

      This doesn't help testing the with/without timeout cases, but if we do just this and don't print the list of builds, then we don't need timeouts.

    I'd like to discuss:

    • How do we determine how long to wait before the API call times out? Different network setups will impose different latencies.
    • Should the timeout be configurable? This would likely facilitate testing.

    cc @bparees @smarterclayton

  5. bparees commented on Aug 5, 2015

    @bparees
    Contributor

    configurable timeout seems like overkill for something like this. one option you might consider is that if a certain debug level is enabled (maybe any debug level), you don't do a timeout?

    as for how long to wait, it's not about the latencies of the network, it's about how long we want to make a user wait for before deciding the user experience would be better if we just returned nothing. 800ms seems like a good value for that.

    it also might make sense to print a "timed out getting current list of builds, run oc get builds to retrieve the list" message if you hit the timeout. My only concern with that is it makes us look bad if that command is timing out all the time.

  6. rhcarvalho commented on Aug 5, 2015

    @rhcarvalho
    Contributor

    thanks @bparees

    configurable timeout seems like overkill for something like this.

    agreed

    one option you might consider is that if a certain debug level is enabled (maybe any debug level), you don't do a timeout?

    oc build-logs --loglevel=1 to disable a timeout feels esoteric to me

    as for how long to wait, it's not about the latencies of the network, it's about how long we want to make a user wait for before deciding the user experience would be better if we just returned nothing. 800ms seems like a good value for that.

    Yep. User experience.
    If your round-trip latency to the OpenShift master exceeds 800ms, you never get any list of builds (exactly what QE is experiencing).

    What we've done in that case then is we made oc build-logs fail with the message "error: A build name is required" in ~830ms instead of ~150ms, what we had before.

    So those users have a worse experience at all times. And without a metric to tell what fraction of oc users will fall into that category, it's hard to say how bad this is.

    it also might make sense to print a "timed out getting current list of builds, run oc get builds to retrieve the list" message if you hit the timeout. My only concern with that is it makes us look bad if that command is timing out all the time.

    After some experimentation locally, I'm tempted to propose not fetching the list of builds, but just showing how to do it.
    The original issue description starts with "A user who sees oc build-logs in the help may get there before understanding how to list builds ...", then it goes on to propose a specific solution. Alternatively, why not simply, and with no variable delaym just show how to list builds?

    Either that or change oc build-logs semantics (and document it) so that calling it with no arguments is equivalent to oc get builds (documented feature instead of an error condition). I'm not a fan of this option myself.

  7. bparees commented on Aug 5, 2015

    @bparees
    Contributor

    oc build-logs --loglevel=1 to disable a timeout feels esoteric to me

    that was by design. I didn't/don't anticipate it being something most people would want to do. if it's taking more than 800ms to get back results, are you going to set a flag so you can wait even longer? the only reason to set that flag in my mind is if you're going to debug why it's taking so long.

    What we've done in that case then is we made oc build-logs fail with the message "error: A build name > is required" in ~830ms instead of ~150ms, what we had before.

    i'd love to know why it's 800ms in their environment. that means pretty much any other command should be taking a long time too. do they just have a huge number of builds? is there something else going on here? are we making multiple calls?

    Alternatively, why not simply, and with no variable delay just show how to list builds?

    sure, we could ultimately fall back to this solution, but let's dig into this a little more before we give up.

    After some experimentation locally, I'm tempted to propose not fetching the list of builds, but just showing how to do it.

    what did you see in your local experimentation that lead you to this conclusion? is it always very slow?

    Either that or change oc build-logs semantics (and document it) so that calling it with no arguments is equivalent to oc get builds (documented feature instead of an error condition). I'm not a fan of this option myself.

    yeah i don't like that either. and i'm not clear how it would be any better... it's still going to take a long time to return.

  8. rhcarvalho commented on Aug 5, 2015

    @rhcarvalho
    Contributor

    i'd love to know why it's 800ms in their environment.

    The env in the bugzilla case: 1) create an OS instance in EC2, 2) ssh into the box and run oc commands there.

    In general, we want to make server latency as low as possible for better user experience. AFAIK, that's in the hands of the cluster admin to make sure relevant clients (let's say from a given region in the globe) can access the cluster within a certain delay. This would be the case for OpenShift Online.

    We can't predict and hard code a value that will satisfy other users in their respective network setups.

    that means pretty much any other command should be taking a long time too. do they just have a huge number of builds? is there something else going on here? are we making multiple calls?

    In that particular case there was only one build, as listed by oc get builds.
    It is very unlikely that we're making multiple calls.

    It is probably acceptable to call oc get builds and wait, let's say, 1~2s to get a list of builds (because ultimately you'll get what you asked for), while very poor to wait >800ms to get an error message about missing argument (something that can be determined locally and quickly).

    oc build-logs --loglevel=1 to disable a timeout feels esoteric to me

    that was by design. I didn't/don't anticipate it being something most people would want to do. if it's taking more than 800ms to get back results, are you going to set a flag so you can wait even longer? the only reason to set that flag in my mind is if you're going to debug why it's taking so long.

    Seems this would be only useful to satisfy testing? Again, listing the builds as part of the error message is not a documented feature, and I don't think it should be.

    After some experimentation locally, I'm tempted to propose not fetching the list of builds, but just showing how to do it.

    what did you see in your local experimentation that lead you to this conclusion? is it always very slow?

    My experimentation showed that writing to stderr from within RunBuildLogs in an adhoc fashion would greatly break the patterns in the CLI code. Improving the pattern to support a "streaming API" for error message would require changes upstream, I think hard to justify.

    Without that, it doesn't really matter how "slow", in absolute numbers, the API call to fetch builds is, the error message from oc build-logs would always be slower with that bit of code we introduced. And, because of the arbitrary timeout, we don't know how often that extra time hanging the terminal would give better user experience (the list of builds).

    @bparees not sure how much you'd value this, but, additionally, given that we don't have any pagination in our existing REST API, this "clever error message within a timeout" approach would fail for projects holding a load of builds: 3 builds/day x 90 days = after 3 months using OS, we're fetching 270 builds to fit them into a list of 10 builds in an error message.

    I bet will be tackling pagination some time soon, and that would require a revisit here to clean up the code (there's a TODO comment).

  9. bparees commented on Aug 5, 2015

    @bparees
    Contributor

    In that particular case there was only one build, as listed by oc get builds.
    It is very unlikely that we're making multiple calls.
    It is probably acceptable to call oc get builds and wait, let's say, 1~2s to get a list of builds (because ultimately you'll get what you asked for), while very poor to wait >800ms to get an error message about missing argument (something that can be determined locally and quickly).

    i'm not sure you got my point here, which is... if "oc build-logs" is taking 800ms to get the list of builds and show it (when there's only one build) then i would expect that "oc get builds", "oc get pods", "oc whatever" would all take ~800ms because the roundtrip time will always be there. Yes you're introducing a latency before showing them an error message which is annoying, but you're not introducing a latency they aren't seeing everywhere else in the product. it's hard to imagine users being tolerate of an 800ms latency under any circumstances.

    Seems this would be only useful to satisfy testing? Again, listing the builds as part of the error message is not a documented feature, and I don't think it should be.

    yes, testing and field debugging.

    @bparees not sure how much you'd value this, but, additionally, given that we don't have any pagination in our existing REST API, this "clever error message within a timeout" approach would fail for projects holding a load of builds: 3 builds/day x 90 days = after 3 months using OS, we're fetching 270 builds to fit them into a list of 10 builds in an error message.

    it's a fair concern and i agree we need pagination (@smarterclayton is that coming?) but we also have build pruning for this reason.

    Anyway all that being said, I think we've invested more time/effort in this enhancement than is justified and there doesn't seem to be a great solution to the problem of the latency it introduces so I guess i'd be ok just going with an error message that tells them how to list the builds. But at least do the user the favor of printing the appropriate "-n " argument dynamically if they invoked oc build-logs with a -n argument, so they can just cut+paste the suggested command.

  10. smarterclayton commented on Aug 5, 2015

    @smarterclayton
    ContributorAuthor

    I don't think 800ms latency is a problem.

    On Wed, Aug 5, 2015 at 1:12 PM, Ben Parees [email protected] wrote:

    In that particular case there was only one build, as listed by oc get
    builds.
    It is very unlikely that we're making multiple calls.
    It is probably acceptable to call oc get builds and wait, let's say, 1~2s
    to get a list of builds (because ultimately you'll get what you asked for),
    while very poor to wait >800ms to get an error message about missing
    argument (something that can be determined locally and quickly).

    i'm not sure you got my point here, which is... if "oc build-logs" is
    taking 800ms to get the list of builds and show it (when there's only one
    build) then i would expect that "oc get builds", "oc get pods", "oc
    whatever" would all take ~800ms because the roundtrip time will always be
    there. Yes you're introducing a latency before showing them an error
    message which is annoying, but you're not introducing a latency they aren't
    seeing everywhere else in the product. it's hard to imagine users being
    tolerate of an 800ms latency under any circumstances.

    Seems this would be only useful to satisfy testing? Again, listing the
    builds as part of the error message is not a documented feature, and I
    don't think it should be.

    yes, testing and field debugging.

    @bparees https://github.com/bparees not sure how much you'd value this,
    but, additionally, given that we don't have any pagination in our existing
    REST API, this "clever error message within a timeout" approach would fail
    for projects holding a load of builds: 3 builds/day x 90 days = after 3
    months using OS, we're fetching 270 builds to fit them into a list of 10
    builds in an error message.

    it's a fair concern and i agree we need pagination (@smarterclayton
    https://github.com/smarterclayton is that coming?) but we also have
    build pruning for this reason.

    Anyway all that being said, I think we've invested more time/effort in
    this enhancement than is justified and there doesn't seem to be a great
    solution to the problem of the latency it introduces so I guess i'd be ok
    just going with an error message that tells them how to list the builds.
    But at least do the user the favor of printing the appropriate "-n "
    argument dynamically if they invoked oc build-logs with a -n argument, so
    they can just cut+paste the suggested command.

    —
    Reply to this email directly or view it on GitHub
    #3359 (comment).

    Clayton Coleman | Lead Engineer, OpenShift

  11. bparees commented on Aug 5, 2015

    @bparees
    Contributor

    @smarterclayton is 800ms latency a problem when your experience is either:

    1. "oc build-logs" - immediately get back an error telling you you need to supply a build name (what happens today)
      or
    2. "oc build-logs" - wait 800ms, get back an error telling you you need to supply a build name (what will happen with this feature)

    that's what this issue boils down to. if we consider (2) acceptable, then ok i guess, but it seems undesirable, which was @rhcarvalho's concern.

    if we feel that (2) is rare enough (once you've run oc build-logs w/ no args once, you probably learn your lesson, if you're in a high latency environment where it doesn't actually give you back a build list) then i guess i can see why we'd feel it's ok.

  12. smarterclayton commented on Aug 5, 2015

    @smarterclayton
    ContributorAuthor

    Running build logs without args is really unlikely - something you do
    once. So either you do it the first time in a high latency environment or
    you don't. You can also cut the timeout down if you want to 500ms. I
    don't consider either of those that bad of a time to wait in this
    particular case.

    On Wed, Aug 5, 2015 at 1:41 PM, Ben Parees [email protected] wrote:

    @smarterclayton https://github.com/smarterclayton is 800ms latency a
    problem when your experience is either:

    1. "oc build-logs" - immediately get back an error telling you you need to
      supply a build name (what happens today)
      or
    2. "oc build-logs" - wait 800ms, get back an error telling you you need to
      supply a build name (what will happen with this feature)

    that's what this issue boils down to. if we consider (2) acceptable, then
    ok i guess, but it seems undesirable, which was @rhcarvalho
    https://github.com/rhcarvalho's concern.

    if we feel that (2) is rare enough (once you've run oc build-logs w/ no
    args once, you probably learn your lesson, if you're in a high latency
    environment where it doesn't actually give you back a build list) then i
    guess i can see why we'd feel it's ok.

    —
    Reply to this email directly or view it on GitHub
    #3359 (comment).

    Clayton Coleman | Lead Engineer, OpenShift

  13. bparees commented on Aug 5, 2015

    @bparees
    Contributor

    ok. so that just leaves how to handle QE's bug in this case. for which i vote for my "verbose logging increases the timeout" solution.

  14. smarterclayton commented on Aug 5, 2015

    @smarterclayton
    ContributorAuthor

    Why do we have to do anything for QE? We try to help you. If we can't
    help you, we don't. Let's not boil the UI ocean

    On Wed, Aug 5, 2015 at 1:50 PM, Ben Parees [email protected] wrote:

    ok. so that just leaves how to handle QE's bug in this case. for which i
    vote for my "verbose logging increases the timeout" solution.

    —
    Reply to this email directly or view it on GitHub
    #3359 (comment).

    Clayton Coleman | Lead Engineer, OpenShift

  15. smarterclayton commented on Aug 5, 2015

    @smarterclayton
    ContributorAuthor

    I'd be more in favor of removing this altogether than starting to make it
    more complex :)

    On Wed, Aug 5, 2015 at 1:54 PM, Clayton Coleman [email protected] wrote:

    Why do we have to do anything for QE? We try to help you. If we can't
    help you, we don't. Let's not boil the UI ocean

    On Wed, Aug 5, 2015 at 1:50 PM, Ben Parees [email protected]
    wrote:

    ok. so that just leaves how to handle QE's bug in this case. for which i
    vote for my "verbose logging increases the timeout" solution.

    —
    Reply to this email directly or view it on GitHub
    #3359 (comment).

    Clayton Coleman | Lead Engineer, OpenShift

    Clayton Coleman | Lead Engineer, OpenShift

  16. mfojtik commented on Aug 5, 2015

    @mfojtik
    Contributor

    @smarterclayton @bparees why not just print "Fetching builds ..." message, make the timeout ~5s or more. I think that message will make users feel better about the fact that there is a latency in fetching builds.

  17. smarterclayton commented on Aug 5, 2015

    @smarterclayton
    ContributorAuthor

    5s? Why would we ever wait 5s? That's way too much latency.

    On Wed, Aug 5, 2015 at 1:58 PM, Michal Fojtik [email protected]
    wrote:

    @smarterclayton https://github.com/smarterclayton @bparees
    https://github.com/bparees why not just print "Fetching builds ..."
    message, make the timeout ~5s or more. I think that message will make users
    feel better about the fact that there is a latency in fetching builds.

    —
    Reply to this email directly or view it on GitHub
    #3359 (comment).

    Clayton Coleman | Lead Engineer, OpenShift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions