Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcylc zero division error from task mean elapsed time #2586

Merged
merged 1 commit into from
Feb 27, 2018

Conversation

sadielbartholomew
Copy link
Collaborator

An (internal Met Office operational) user has noticed a traceback dialog in the GUI:

Traceback (most recent call last):
  File "<HOME>/cylc.git/lib/cylc/gui/updater_tree.py", line 257, in update_gui
    100 * (tnow - tstart) / (tetc_unix - tstart))
ZeroDivisionError: float division

A brief look at the code reveals this is due to tasks which have a mean elapsed time value of zero - quite how this has occurred in a real suite is still a bit of a mystery to me and while the fix was trivial and the logic easy to follow, the difficultly here was reproducing the error (for self-review purposes) i.e. setting up a suite so that at least one task would have mean elapsed time of zero.

Eventually I just did a bodge job, so (unless you can easily come up with a more clever idea!) to recreate, just change line 240 to meant = 0.0 and the if tnow > tetc_unix statement on line 253 to if False to automatically proceed to read the line in question, then run some suite with at least one task with script sleep 10 or similar that cycles at least once (so meant gets re-computed).

N.B. there is some logic on 280:283 which does change meant to 1 if it is in fact 0 and I initially tried essentially moving that above the conditionals in question so the zero division error would not ever get raised, but it does influence the conditional on 261:264 so this simple change seemed more appropriate.

@sadielbartholomew sadielbartholomew added the bug Something is wrong :( label Feb 26, 2018
@sadielbartholomew sadielbartholomew self-assigned this Feb 26, 2018
@sadielbartholomew sadielbartholomew added this to the next release milestone Feb 26, 2018
Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

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

@hjoliver hjoliver merged commit 0eed049 into cylc:master Feb 27, 2018
@sadielbartholomew sadielbartholomew deleted the updater-tree-zero-div-error branch February 27, 2018 10:27
matthewrmshin added a commit to matthewrmshin/cylc-flow that referenced this pull request Mar 26, 2018
* cylc#2606 Fix poll when job.status has no batch sys info
* cylc#2604 Lowercase for shell bool vars
* cylc#2603 Fix gui insert nested family
* cylc#2602 gcylc: prevent negative job progress
* cylc#2596 Fix ref by value of parameters with plus/minus
* cylc#2592 Permit syntax errors with trigger edits
* cylc#2588 Fix trigger --edit with host select
* cylc#2586 Fix gcylc zero division error from task mean elapsed time
* cylc#2585 Fix recovery of a failed host select command
* cylc#2579 Fix gscan exception hook dialog closure incapacity
* cylc#2574 Fix gscan host port range owner behaviour
* cylc#2571 gcylc: fix tailer of remote job log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants