https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
Bug ID: 69895 Summary: Calling any script passing the -help argument, performs an api call to the default configured wiki Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: martineznovo@gmail.com Web browser: --- Mobile Platform: ---
When calling any script with the -help argument to see the parameters it can handle, the bot makes a call to the api of the default configured wiki.
I noticed it because my default configured wiki is a test wiki hosted locally, and I have the webserver stopped when I don't need it running. When I need to run the bot, I manually specify -family:WHATEVER
Under that circumstances, every attempt to run -help on any script causes an error because the default configured wiki-family is not accessible:
$ python pwb.py replace.py -help
ERROR: Traceback (most recent call last): File "/path/pywikibot/data/api.py", line 341, in submit body=paramstring) File "/path/pywikibot/comms/http.py", line 184, in request raise request.data error: [Errno 111] Connection refused
WARNING: Waiting 5 seconds before retrying. ^CTraceback (most recent call last): File "pwb.py", line 171, in <module> run_python_file(fn, argv, argvu) File "pwb.py", line 69, in run_python_file exec(compile(source, filename, "exec"), main_mod.__dict__) File "scripts/replace.py", line 685, in <module> main() File "scripts/replace.py", line 483, in main local_args = pywikibot.handleArgs(*args) File "/path/pywikibot/bot.py", line 666, in handleArgs init_handlers() File "/path/pywikibot/bot.py", line 248, in init_handlers writelogheader() File "/path/pywikibot/bot.py", line 318, in writelogheader log(u'SITE VERSION: %s' % unicode(site.live_version())) File "/path/pywikibot/site.py", line 1877, in live_version expiry=0 if force else 1) File "/path/pywikibot/site.py", line 1097, in get preloaded = self._get_general(key, expiry) File "/path/pywikibot/site.py", line 1043, in _get_general default_info = self._get_siteinfo(props, expiry) File "/path/pywikibot/site.py", line 967, in _get_siteinfo siprop='|'.join(props)).submit() File "/path/pywikibot/data/api.py", line 580, in submit self._data = super(CachedRequest, self).submit() File "/path/pywikibot/data/api.py", line 358, in submit self.wait() File "/path/pywikibot/data/api.py", line 469, in wait time.sleep(self.retry_wait) KeyboardInterrupt <type 'exceptions.KeyboardInterrupt'>
Of course, it works when I have apache running, but such connections seem unnecessary when the bot doesn't have to run anything.
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |High CC| |jayvdb@gmail.com Severity|normal |minor
--- Comment #1 from John Mark Vandenberg jayvdb@gmail.com --- Indeed. I was going to raise this bug myself, as it is preventing automated testing of the scripts before code review (as the WMF test boxes are not supposed to make network connections).
https://gerrit.wikimedia.org/r/#/c/154242/8..9/tests/script_tests.py,unified
In addition to disabling connecting to the wiki for '-help', we should offer to disable that call to site.live_version() in the startup sequence for _all_ commands. I did a partial solution in https://gerrit.wikimedia.org/r/137009 , but there is still more unnecessary network activity during startup.
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
--- Comment #2 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 157799 had a related patch set uploaded by John Vandenberg: Remove user messages check during startup
https://gerrit.wikimedia.org/r/157799
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
--- Comment #3 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 166583 had a related patch set uploaded by John Vandenberg: Dont load site at startup to log site version
https://gerrit.wikimedia.org/r/166583
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
--- Comment #4 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 157799 merged by jenkins-bot: Remove user messages check during startup
https://gerrit.wikimedia.org/r/157799
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |70936
--- Comment #5 from John Mark Vandenberg jayvdb@gmail.com --- One merged; one more to go.
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
--- Comment #6 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 166583 merged by jenkins-bot: Dont load site at startup to log site version
https://gerrit.wikimedia.org/r/166583
https://bugzilla.wikimedia.org/show_bug.cgi?id=69895
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED Resolution|--- |FIXED
pywikipedia-bugs@lists.wikimedia.org