Revision: 4875 Author: rotem Date: 2008-01-13 18:21:45 +0000 (Sun, 13 Jan 2008)
Log Message: ----------- (bug 1869983) Catch ServerError exceptions in Page.put.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-01-13 18:15:26 UTC (rev 4874) +++ trunk/pywikipedia/wikipedia.py 2008-01-13 18:21:45 UTC (rev 4875) @@ -1270,6 +1270,14 @@ response, data = self.site().postForm(address, predata, sysop) except httplib.BadStatusLine, line: raise PageNotSaved('Bad status line: %s' % line.line) + except ServerError: + output(u''.join(traceback.format_exception(*sys.exc_info()))) + output(u'Got a server error when putting; will retry in %i minutes.' % retry_delay) + time.sleep(60 * retry_delay) + retry_delay *= 2 + if retry_delay > 30: + retry_delay = 30 + continue if data != u'': # Saving unsuccessful. Possible reasons: # server lag, edit conflict or invalid edit token.
On Jan 13, 2008 7:21 PM, rotem@svn.wikimedia.org wrote:
Revision: 4875 Author: rotem Date: 2008-01-13 18:21:45 +0000 (Sun, 13 Jan 2008)
Log Message:
(bug 1869983) Catch ServerError exceptions in Page.put.
Modified Paths:
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
--- trunk/pywikipedia/wikipedia.py 2008-01-13 18:15:26 UTC (rev 4874) +++ trunk/pywikipedia/wikipedia.py 2008-01-13 18:21:45 UTC (rev 4875) @@ -1270,6 +1270,14 @@ response, data = self.site().postForm(address, predata, sysop) except httplib.BadStatusLine, line: raise PageNotSaved('Bad status line: %s' % line.line)
except ServerError:
output(u''.join(traceback.format_exception(*sys.exc_info())))
output(u'Got a server error when putting; will retry in %i minutes.' % retry_delay)
time.sleep(60 * retry_delay)
retry_delay *= 2
if retry_delay > 30:
retry_delay = 30
continue if data != u'': # Saving unsuccessful. Possible reasons: # server lag, edit conflict or invalid edit token.
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
I did some more investigation on this and I'm not sure whether this is a good idea. I basically had the same code in CommonsDelinker:
while True: try: [...] page.put(new_text.get(), m_summary.get()) return 'ok' except wikipedia.ServerError, e: output(u'Warning! ServerError: %s' % str(e)) [...] output(u'Retrying...')
Which resulted in the following:
http://fr.wikipedia.org/w/index.php?title=Martina_Navr%C3%A1tilov%C3%A1&... http://en.wikipedia.org/w/index.php?title=Wikipedia:Reference_desk_archive/M... http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Histmag/brudnopis5&...
My logs give the following:
51800 [2007-11-21 11:19:59] Warning! ServerError: (32, 'Broken pipe') 51801 [2007-11-21 11:19:59] Retrying... 51802 Changing page [[wikipedia:fr:Martina Navr<C3><A1>tilov<C3><A1>]] 51805 [2007-11-21 11:28:35] Warning! ServerError: (32, 'Broken pipe') 51806 [2007-11-21 11:28:35] Retrying... 51807 Changing page [[wikipedia:fr:Martina Navr<C3><A1>tilov<C3><A1>]]
And that continues for some time... I'm not sure how to fix this. Anybody advise?
Bryan
On Jan 13, 2008 8:58 PM, Bryan Tong Minh bryan.tongminh@gmail.com wrote:
On Jan 13, 2008 7:21 PM, rotem@svn.wikimedia.org wrote:
Revision: 4875 Author: rotem Date: 2008-01-13 18:21:45 +0000 (Sun, 13 Jan 2008)
Log Message:
(bug 1869983) Catch ServerError exceptions in Page.put.
Modified Paths:
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
--- trunk/pywikipedia/wikipedia.py 2008-01-13 18:15:26 UTC (rev 4874) +++ trunk/pywikipedia/wikipedia.py 2008-01-13 18:21:45 UTC (rev 4875) @@ -1270,6 +1270,14 @@ response, data = self.site().postForm(address, predata, sysop) except httplib.BadStatusLine, line: raise PageNotSaved('Bad status line: %s' % line.line)
except ServerError:
output(u''.join(traceback.format_exception(*sys.exc_info())))
output(u'Got a server error when putting; will retry in %i minutes.' % retry_delay)
time.sleep(60 * retry_delay)
retry_delay *= 2
if retry_delay > 30:
retry_delay = 30
continue if data != u'': # Saving unsuccessful. Possible reasons: # server lag, edit conflict or invalid edit token.
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
I did some more investigation on this and I'm not sure whether this is a good idea. I basically had the same code in CommonsDelinker:
while True: try:
[...] page.put(new_text.get(), m_summary.get()) return 'ok' except wikipedia.ServerError, e: output(u'Warning! ServerError: %s' % str(e)) [...] output(u'Retrying...')
Which resulted in the following:
http://fr.wikipedia.org/w/index.php?title=Martina_Navr%C3%A1tilov%C3%A1&... http://en.wikipedia.org/w/index.php?title=Wikipedia:Reference_desk_archive/M... http://pl.wikipedia.org/w/index.php?title=Wikipedysta:Histmag/brudnopis5&...
My logs give the following:
51800 [2007-11-21 11:19:59] Warning! ServerError: (32, 'Broken pipe') 51801 [2007-11-21 11:19:59] Retrying... 51802 Changing page [[wikipedia:fr:Martina Navr<C3><A1>tilov<C3><A1>]] 51805 [2007-11-21 11:28:35] Warning! ServerError: (32, 'Broken pipe') 51806 [2007-11-21 11:28:35] Retrying... 51807 Changing page [[wikipedia:fr:Martina Navr<C3><A1>tilov<C3><A1>]]
And that continues for some time... I'm not sure how to fix this. Anybody advise?
Bryan
r4877 should have fixed it.
Bryan
pywikipedia-l@lists.wikimedia.org