New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 731199 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

Division by zero error from "summarize_build_stats"

Reported by jrbarnette@chromium.org, Jun 8 2017

Issue description

If you run this command:
    bin/summarize_build_stats --past-week --end-date 2017-06-02

The command fails with the following exception:
11:27:34: INFO: Running cidb query on pid 19716, repr(query) starts with <sqlalchemy.sql.selectable.Select at 0x7f3da66e8710; Select object>
11:27:34: INFO: No runs included.
summarize_build_stats: Unhandled exception:
Traceback (most recent call last):
  File "bin/summarize_build_stats", line 93, in <module>
    main()
  File "bin/summarize_build_stats", line 29, in main
    wrapper.DoMain()
  File "/usr/local/google/home/jrbarnette/repos/cros.b/chromite/scripts/wrapper.py", line 164, in DoMain
    commandline.ScriptWrapperMain(FindTarget)
  File "/usr/local/google/home/jrbarnette/repos/cros.b/chromite/lib/commandline.py", line 837, in ScriptWrapperMain
    ret = target(argv[1:])
  File "/usr/local/google/home/jrbarnette/repos/cros.b/chromite/scripts/summarize_build_stats.py", line 811, in main
    options.bad_patch_candidates)
  File "/usr/local/google/home/jrbarnette/repos/cros.b/chromite/scripts/summarize_build_stats.py", line 251, in Summarize
    return self.SummarizeCQ(bad_patch_candidates=bad_patch_candidates)
  File "/usr/local/google/home/jrbarnette/repos/cros.b/chromite/scripts/summarize_build_stats.py", line 331, in SummarizeCQ
    false_rejection_count)
  File "/usr/local/google/home/jrbarnette/repos/cros.b/chromite/scripts/summarize_build_stats.py", line 216, in FalseRejectionRate
    rejection_count * 100. / (rejection_count + good_patch_count)
ZeroDivisionError: float division by zero

 
Looking higher up in the output from the command, you find this:

17:30:19: INFO: Running cidb query on pid 98412, repr(query) starts with 'SELECT id, build_config, start_time, finish_time, status, waterfall, build_number, builder_name, pl
17:30:19: INFO: Fetched no builds.
17:30:19: INFO: Sorting by build number.

"Fetched no builds" seems wrong.  There were in fact quite a few builds in the
one week period ending 2017-06-02.

HORATIO: Have after. To what issue will this come?
MARCELLUS: Something is rotten in the state of Denmark.

Comment 2 by nxia@chromium.org, Jun 9 2017

Cc: nxia@chromium.org pprabhu@chromium.org dgarr...@chromium.org

Comment 3 by nxia@chromium.org, Jun 9 2017

I run "bin/summarize_build_stats --past-week --end-date 2017-06-02 --cred-dir ~/cidb_creds/prod_cidb_gen2_readonly/" and it works fine for me.

I think you were using the old cidb-creds connecting to the old cidb instance which has been abandoned. Please delete ".cache/cidb_creds" or explicitly pass in the path to the new cidb_cred dir.  

Comment 4 by nxia@chromium.org, Jun 9 2017

Owner: jrbarnette@chromium.org
Status: (was: Available)
Cc: xixuan@chromium.org
Owner: xixuan@chromium.org
Status: Assigned
I've confirmed that the problem is credentials, in that I can
download correct credentials and use them with the --cred-dir
option.  However, I'm unable to explain why the default credentials
aren't working...

I suspect xixuan@ can offer up some additional understanding.

OK.  Adding some clarification regarding the nature of the failure:
  * The credentials under "prod_cidb_gen2_readonly" work.
  * The credentials under "prod_replica_cidb_gen2_readonly" don't work.

From the very beginning of go/cros-cidb-admin (I just added a section days ago), it explains that if you want your tool work, an essential step is to add your IP to the restricted network of the corresponding cidb instance.

Why "prod_cidb_gen2_readonly" work?

Answer: I add a mtv-related IP "104.132.0.0/16" to the restricted network of cidb-gen2, which should cover Richard's IP.

Why "prod_replica_cidb_gen2_readonly" don't work?

Answer: I don't add any non-personal IP to the restricted network of cidb-gen2-replica2. 

Short-term solution: 
I add "104.132.0.0/16" to cidb-gen2-replica2, so that anyone in our group's able to connect to it. Please have a retry?

Long-term solution:
We should remove the IP-based connection method, and instead, use some group-based connection method.
> Short-term solution: 
> I add "104.132.0.0/16" to cidb-gen2-replica2, so that anyone in our group's able to connect to it. Please have a retry?

That seems to have done it.  The command now works right out of
the box.

Comment 9 by xixuan@chromium.org, Jun 19 2017

Status: Fixed (was: Assigned)

Sign in to add a comment