Page MenuHomePhabricator

template.py does not show when a page is saved
Closed, ResolvedPublic

Description

When saving a page with template the saving comment is missing:

C:\pwb\GIT\core>pwb.py template Persondata -remove -page:"%D8%A2%D8%AF%D8%A7%D9%85_%D9%87%D8%A7%D9%85%D9%84" -lang:ar
WARNING: Bot.site was not set before being retrieved.
WARNING: Using the default site: wikipedia:ar
Retrieving 1 pages from wikipedia:ar.
WARNING: Bot.site was not set before being retrieved.
WARNING: Using the default site: wikipedia:ar


>>> آدام هامل <<<
@@ -17,5 +17 @@
+
- {{Persondata
- |NAME=آدام هامل
- |ALTERNATIVE NAMES=
- |SHORT DESCRIPTION=لاعب كرة قدم إنجليزي
- |DATE OF BIRTH={{تاريخ الميلاد|1988|1|25|df=y}}

Do you want to accept these changes? ([y]es, [N]o, [e]dit, open in [b]rowser, [a
]ll, [q]uit): y
Sleeping for 4.9 seconds, 2016-04-08 09:26:40

I expect sth like
Page [[آدام هامل]] saved.
at the end.

Also site setting should be improved to avoid this warnings.

Event Timeline

Xqt triaged this task as Medium priority.Apr 8 2016, 9:05 AM

A changed behaviour was introduced by https://gerrit.wikimedia.org/r/#/c/248680/. I suppose to let quiet=False by default.

I think the problem appears when throttling is > 0.
The queue in replace.py is empty and the bot.run() exits before the save() callback (which would fill the queue of the pending pages) is triggered.
And when answer is yes, as async=True.

Also, the behavior of stopme was changed: https://gerrit.wikimedia.org/r/#/c/276428/, it does not clear async_manager by default.

Change 282433 had a related patch set uploaded (by Mpaa):
Allow stopme() to clear async_manager

https://gerrit.wikimedia.org/r/282433

If the behaviour of stopme was changed, is it a regression, or was it an intentional breaking change?

If intentional, we need to justify the breaking change. Did the changed behaviour make it more similar to compat?
If the breaking change is appropriate, we need to Pywikibot-Announce an explanation to our userbase that they need to update their code if they used the async thread ??

The intention of stopme() is to drop the bot PID out of the throttle list. Unfortunately it didn't work when the script is not terminated after that. Therefore the _flush was introduced to flush async_manager at exit time only. The implementation in replace.py looks like a dirty hack. I guess we can

  • keep printing inside save(). I do not understand why this should not be there.
  • put the print functionality into the callback method
  • add a print function to the queue and fix the calculation of the remaining pages and putting time.

Change 282433 abandoned by Mpaa:
ReplaceBot: use pywikibot._flush() to clear async_manager

Reason:
Xqt will take care of it without too many hacks ...

https://gerrit.wikimedia.org/r/282433

Change 282818 had a related patch set uploaded (by Xqt):
[bugfix] Port cache_output from compat

https://gerrit.wikimedia.org/r/282818

Dvorapa subscribed.

Does not seems to be a dupe

Change 282818 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Port cache_output from compat

https://gerrit.wikimedia.org/r/282818