Skip to content

Issue #1488 - added build duration and tweaked build counting in describer#1624

Merged
openshift-bot merged 1 commit intoopenshift:masterfrom
soltysh:post_1609
Apr 22, 2015
Merged

Issue #1488 - added build duration and tweaked build counting in describer#1624
openshift-bot merged 1 commit intoopenshift:masterfrom
soltysh:post_1609

Conversation

@soltysh
Copy link
Contributor

@soltysh soltysh commented Apr 7, 2015

@bparees PTAL, I've added duration and tweaked the build counting 😉 and now we can safely close #1488

@soltysh
Copy link
Contributor Author

soltysh commented Apr 7, 2015

This is how it looks with this:

[vagrant@openshiftdev origin]$ osc describe buildconfig ruby-sample-build
Name:                           ruby-sample-build
Created:                        2015-04-07 11:24:07 +0000 UTC
Labels:                         name=ruby-sample-build,template=application-template-stibuild
Latest Version:                 12
Strategy:                       STI
Builder Image:                  openshift/ruby-20-centos7
Incremental Build:              yes
Source Type:                    Git
URL:                            git://github.com/openshift/ruby-hello-world.git
Output to:                      origin-ruby-sample:latest
Output Spec:                    <none>
Webhook Generic:                https://10.0.2.15:8443/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic
Webhook Github:                 https://10.0.2.15:8443/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/github
Image Repository Trigger:       ruby-20-centos7
- Tag:                          latest
- Image:                        openshift/ruby-20-centos7
- LastTriggeredImageID:         openshift/ruby-20-centos7:latest
Builds(Name,Status,Duration,Creation Time)
- ruby-sample-build-12 Failed (31s) 2015-04-07 11:25:01 +0000 UTC
- ruby-sample-build-11 Failed (21s) 2015-04-07 11:24:32 +0000 UTC
- ruby-sample-build-10 Failed (2m6s) 2015-04-07 11:24:31 +0000 UTC
- ruby-sample-build-9 Failed (2m6s) 2015-04-07 11:24:30 +0000 UTC
- ruby-sample-build-8 Failed (2m17s) 2015-04-07 11:24:29 +0000 UTC
- ruby-sample-build-7 Failed (21s) 2015-04-07 11:24:28 +0000 UTC
- ruby-sample-build-6 Failed (2m17s) 2015-04-07 11:24:27 +0000 UTC
- ruby-sample-build-5 Failed (2m17s) 2015-04-07 11:24:25 +0000 UTC
- ruby-sample-build-4 Failed (1m58s) 2015-04-07 11:24:23 +0000 UTC
- ruby-sample-build-3 Failed (21s) 2015-04-07 11:24:22 +0000 UTC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StartTimestamp could be nil. For that matter so could CompletionTimestamp so i'm surprised this is working?

In anycase you need to look at this logic to see how complex this really needs to be do to it right (which is why I didn't do it :) )

https://github.com/openshift/origin/blob/master/pkg/cmd/cli/describe/describer.go#L114

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, I'll extract a method for doing that, thx.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See pkg/api/graph/deployment.go, if you extract extract it from both places.

----- Original Message -----

    for i := range sortedBuilds {
        // iterate backwards so we're printing the newest items first
        build := sortedBuilds[len(sortedBuilds)-1-i]
  •       fmt.Fprintf(out, fmt.Sprintf("- %s %s %v\n", build.Name, build.Status,
    
    build.CreationTimestamp.Rfc3339Copy().Time))
  •       c++
    
  •       duration :=
    
    build.CompletionTimestamp.Rfc3339Copy().Time.Sub(build.StartTimestamp.Rfc3339Copy().Time)

If so, I'll extract a method for doing that, thx.


Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1624/files#r27883923

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see #1621

----- Original Message -----

See pkg/api/graph/deployment.go, if you extract extract it from both places.

----- Original Message -----

  for i := range sortedBuilds {
      // iterate backwards so we're printing the newest items first
      build := sortedBuilds[len(sortedBuilds)-1-i]
  •     fmt.Fprintf(out, fmt.Sprintf("- %s %s %v\n", build.Name,
    
    build.Status,
    build.CreationTimestamp.Rfc3339Copy().Time))
  •     c++
    
  •     duration :=
    
    build.CompletionTimestamp.Rfc3339Copy().Time.Sub(build.StartTimestamp.Rfc3339Copy().Time)

If so, I'll extract a method for doing that, thx.


Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1624/files#r27883923

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That section is insane, and means the server should be returning duration so that clients don't have to implement it. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was about to write that, after carefully studying the code you've pointed to, where I see you also print waiting time as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Duration here will specifically be of the build itself, meaning if it hasn't started yet (CreationTimestamp==0) it's Duration will be 0. In all other cases it will always show the Duration for the moment of GET, which obviously mean it'll change for running builds, but will be constant for Finished, Cancelled etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be a change for waiting builds since today we have the duration for builds that haven't started yet...what's your plan for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That waiting information is only in build describe and I'll leave it there as is, since I'm not planning to add descriptive field about the duration it'll contain just the build duration. So in a case of waiting duration will be 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that:

Builds:
  Name                  Status          Duration        Creation Time
  ruby-sample-build-23  Complete        50s             2015-04-08 13:26:53 +0000 UTC
  ruby-sample-build-22  Pending         0               2015-04-08 13:18:52 +0000 UTC
  ruby-sample-build-20  Failed          31s             2015-04-08 13:18:51 +0000 UTC

@smarterclayton
Copy link
Contributor

Use tab writer to align the columns - the uneven output is ugly.

@smarterclayton
Copy link
Contributor

Lowercase the status, and use formatRelativeTime() instead of displaying the exact time.

@smarterclayton
Copy link
Contributor

Drop the dash in front of each line and do an indent consistent with the rest of the page (usually \t but smaller is ok)

@soltysh
Copy link
Contributor Author

soltysh commented Apr 8, 2015

I've addressed all the comments except for the formatRelativeTime() I'm waiting for #1621. Current output is following:

Builds:
  Name                  Status          Duration                Creation Time
  ruby-sample-build-26  pending         waiting for 2s          2015-04-08 14:42:33 +0000 UTC
  ruby-sample-build-25  running         running for 16s         2015-04-08 14:42:07 +0000 UTC
  ruby-sample-build-24  complete        50s                     2015-04-08 14:39:27 +0000 UTC
  ruby-sample-build-23  complete        50s                     2015-04-08 13:26:53 +0000 UTC
  ruby-sample-build-22  failed          1m0s                    2015-04-08 13:18:52 +0000 UTC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're going to output "waiting for XXXs" for builds that were canceled before starting. Should output "waited"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll prepare test cases for that and then I'll change it accordingly.

@bparees
Copy link
Contributor

bparees commented Apr 8, 2015

one nit, otherwise this looks much nicer, thanks!

@soltysh
Copy link
Contributor Author

soltysh commented Apr 10, 2015

@bparees addressed that one comment and added tests for that, squashed it all, ready to merge.

@mfojtik
Copy link
Contributor

mfojtik commented Apr 10, 2015

LGTM

@bparees
Copy link
Contributor

bparees commented Apr 10, 2015

latm [merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/1638/) (Image: devenv-fedora_1327)

@soltysh
Copy link
Contributor Author

soltysh commented Apr 21, 2015

Rebased.

@soltysh
Copy link
Contributor Author

soltysh commented Apr 21, 2015

re-[test] I don't understand why server died when testing UI.

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_openshift3/1875/)

@smarterclayton
Copy link
Contributor

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin up to 1f63923

openshift-bot pushed a commit that referenced this pull request Apr 22, 2015
@openshift-bot openshift-bot merged commit 6335763 into openshift:master Apr 22, 2015
@soltysh soltysh deleted the post_1609 branch April 22, 2015 12:04
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.

osc describe buildconfig mybuildcfg should show 10 last builds

5 participants