• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ICRAR / ngas / 431
69%

Build:
DEFAULT BRANCH: master
Ran 03 Sep 2020 07:45AM UTC
Jobs 7
Files 163
Run time 12min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
431

push

travis-ci

rtobar
Deal correctly with errors when archiving logfiles

Before logfiles are rotated (i.e., removed) a series of processing tasks
are performed onto them. Among these, the first one is to archive the
logfile into the NGAS server itself, if the server has been configured
for this. During normal operations this is not a problem, but exactly on
the first try, when the janitor process has just been created and the
HTTP server might not be bound yet, it might result on an ECONNREFUSED
error. This produced big error messages on the logs, while in reality
this is a transient error that should disappear on the next try.

A second, more general problem, was found while inspecting this code:
logfiles were not renamed back to have their original ".unsaved"
extensions when errors happened. This meant that when errors in general
were found (and in particular when ECONNREFUSED was raised) logfiles
were not picked up by successive janitor cycles.

This commit acknowledges these problems, improving the handling of the
ECONNREFUSED error in particular, and of errors in general. On the on
hand, when the ECONNREFUSED error is encountered we simply issue a
warning log statement instead of letting the exception to propagate up
through the stack. On the other hand, if *any* error happens during
archiving we rename the file back to its original *.unsaved name so it
gets picked up again in the next janitor cycle.

To make code and error handling a bit simpler I took the chance of
moving the archiving of files into a separate try_archiving() function,
whose invocation is then surrounded by the error handling block.
Additionally I also added a sorted() call to process unsaved logfiles in
time order, which until now wasn't guaranteed (and is a nice property to
have).

This commit addresses #26.

Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>

19 of 19 new or added lines in 1 file covered. (100.0%)

13344 of 19451 relevant lines covered (68.6%)

4.78 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
10
100.0
src/ngamsServer/ngamsServer/janitor/rotated_logfiles_handler.py

Uncovered Existing Lines

Lines Coverage ∆ File
1
100.0
src/ngamsCore/ngamsLib/ngamsDbNgasSubscribers.py
1
100.0
src/ngamsServer/ngamsServer/commands/unsubscribe.py
2
100.0
src/ngamsServer/ngamsServer/janitor/backlog_buffer_checker.py
2
100.0
src/ngamsServer/ngamsServer/ngamsDbSnapshotUtils.py
Jobs
ID Job ID Ran Files Coverage
1 431.1 (DB=sqlite3) 03 Sep 2020 07:45AM UTC 0
68.24
Travis Job 431.1
2 431.2 (DB=mysql) 03 Sep 2020 07:46AM UTC 0
68.32
Travis Job 431.2
3 431.3 (DB=postgresql) 03 Sep 2020 07:47AM UTC 0
68.32
Travis Job 431.3
4 431.4 03 Sep 2020 07:57AM UTC 0
68.28
Travis Job 431.4
5 431.5 03 Sep 2020 07:45AM UTC 0
68.28
Travis Job 431.5
6 431.6 03 Sep 2020 07:56AM UTC 0
68.36
Travis Job 431.6
7 431.7 03 Sep 2020 07:56AM UTC 0
68.35
Travis Job 431.7
Source Files on build 431
  • Tree
  • List 163
  • Changed 31
  • Source Changed 1
  • Coverage Changed 31
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Travis Build #431
  • c6556bcd on github
  • Prev Build on master (#428)
  • Next Build on master (#431)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc