Magul added a comment.

Ok, I added some more statistics informations about failing test on www.lojban.org:

from datetime import datetime
from datetime import timedelta

from pywikibot.site_detect import MWSite
from pywikibot.exceptions import ServerError
from requests.exceptions import ConnectionError, ReadTimeout

attempt_counter = 0
fail_counter = 0
max_successive_fail_counter = 0
max_outage = timedelta()
curr_successive_fail_counter = 0
curr_outage = timedelta()

global_start = datetime.now()
outage_start = None

fails_statistics = {}

while True:
    try:
        try:
            attempt_counter += 1
            _ = MWSite('http://www.lojban.org/tiki/tiki-index.php?page=$1')
        except (AttributeError, ConnectionError, ReadTimeout, RuntimeError, ServerError):
            if curr_successive_fail_counter == 0:
                outage_start = datetime.now()

            fail_counter += 1
            curr_successive_fail_counter += 1
        else:
            if curr_successive_fail_counter > 0:
                curr_outage = datetime.now() - outage_start
            max_outage = max(max_outage, curr_outage)
            fails_statistics[curr_successive_fail_counter] = fails_statistics.get(
                curr_successive_fail_counter, 0) + 1

            max_successive_fail_counter = max(max_successive_fail_counter,
                                              curr_successive_fail_counter)
            curr_successive_fail_counter = 0
    except KeyboardInterrupt:
        break

global_stop = datetime.now()

print('''
Start testing at: {}
End testing at: {}
Testing time: {}
Attempt count: {}
Failure count: {}

Longest outage: {}
Maximum successive fails: {}

Fails statistics: {}
'''.format(global_start,
           global_stop,
           global_stop - global_start,
           attempt_counter,
           fail_counter,
           max_outage,
           max_successive_fail_counter,
           fails_statistics))

and after 5 hours of running it got:

Start testing at: 2016-12-13 20:21:57.746518
End testing at: 2016-12-14 01:07:24.801149
Testing time: 4:45:27.054631
Attempt count: 18649
Failure count: 134

Longest outage: 0:00:19.348121
Maximum successive fails: 68

Fails statistics: {0: 18506, 1: 6, 60: 1, 68: 1}

After that results I'm thinking about rerunning test 100 times. Ususally it will take only one run, but it occurs, that 60-70 successive failures is not such uncommon.


TASK DETAIL
https://phabricator.wikimedia.org/T151368

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Magul
Cc: gerritbot, Dalba, pywikibot-bugs-list, Aklapper, Magul, Th3d3v1ls, Ramalepe, Liugev6, Tbscho, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to