Closed Bug 1240136 Opened 4 years ago Closed 4 years ago

nagios queue check shouldn't raise an exception if a file doesn't exist

Categories

(Infrastructure & Operations Graveyard :: CIDuty, task)

task
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: catlee, Assigned: catlee)

Details

Attachments

(1 file)

[root@buildbot-master116.bb.releng.usw2.mozilla.com queue]# /builds/buildbot/queue/bin/python /builds/buildbot/queue/tools/buildbot-helpers/check_queuedir.py /dev/shm/queue/pulse
Unhandled exception
Traceback (most recent call last):
  File "/builds/buildbot/queue/tools/buildbot-helpers/check_queuedir.py", line 73, in main
    d_status, d_msgs = check_queuedir(d, options)
  File "/builds/buildbot/queue/tools/buildbot-helpers/check_queuedir.py", line 32, in check_queuedir
    os.path.getmtime(os.path.join(d, 'new', f)) for f in new_files)
  File "/builds/buildbot/queue/tools/buildbot-helpers/check_queuedir.py", line 32, in <genexpr>
    os.path.getmtime(os.path.join(d, 'new', f)) for f in new_files)
  File "/builds/buildbot/queue/lib/python2.7/genericpath.py", line 54, in getmtime
    return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/dev/shm/queue/pulse/new/1452593761-44-2280efrQ4w.937'
Assignee: nobody → catlee
Attachment #8708558 - Flags: review?(bugspam.Callek)
Comment on attachment 8708558 [details] [diff] [review]
bug1240136-tools.patch

Review of attachment 8708558 [details] [diff] [review]:
-----------------------------------------------------------------

::: buildbot-helpers/check_queuedir.py
@@ +16,5 @@
> +            mtime = os.path.getmtime(f)
> +            if retval is None:
> +                retval = mtime
> +            else:
> +                retval = min(retval, mtime)

I would have optimized by putting the file IO first, appending to a list of mtimes and then calculating the min at the end, rather than re-calcing min each time. But I don't know offhand if thats worth the complexity, so r+
Attachment #8708558 - Flags: review?(bugspam.Callek) → review+
https://hg.mozilla.org/build/tools/rev/ecd13e8571342f30ca94480d0db7414d11ed08f3
Bug 1240136 - Handle missing files when finding oldest queue entry r=Callek
Attachment #8708558 - Flags: checked-in+
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Product: Release Engineering → Infrastructure & Operations
Product: Infrastructure & Operations → Infrastructure & Operations Graveyard
You need to log in before you can comment on or make changes to this bug.