Discussion:
[pywikibot] How to avoid edit conflicts?
Bináris
2018-02-17 11:12:46 UTC
Permalink
Hi,

I have
target = pywikibot.Page(site, uploadPage)
oldtext = target.get()
<long computing>
target.put(pretext + text, uploadComment)

pywikibot.exceptions.EditConflict: An edit conflict has occured.

So, is the likelihood of an edit conflict connected to elpased time between
instantiation and put(), or between get() and put()?
Is it useful to reinstantiate the page?
Is it useful to give a second chance to put() in case of edit conflict, or
loop it?
--
Bináris
Bináris
2018-02-17 12:46:34 UTC
Permalink
I mean <long computing> lasts 30 hours, so I *really *don't want edit
conflicts, and I got 2 during tests, because of frequent edits.
Post by Bináris
Hi,
I have
target = pywikibot.Page(site, uploadPage)
oldtext = target.get()
<long computing>
target.put(pretext + text, uploadComment)
pywikibot.exceptions.EditConflict: An edit conflict has occured.
So, is the likelihood of an edit conflict connected to elpased time
between instantiation and put(), or between get() and put()?
Is it useful to reinstantiate the page?
Is it useful to give a second chance to put() in case of edit conflict, or
loop it?
--
Bináris
--
Bináris
John
2018-02-17 13:42:23 UTC
Permalink
If I recall corectly mediawiki uses the timestamp of the .get() however
just redoing the .get() right before the .put() will just overwrite the
changes made by the other user instead of merging them. You would need to
re-manipulate the text object and re-do all of all of your changes.
Post by Bináris
I mean <long computing> lasts 30 hours, so I *really *don't want edit
conflicts, and I got 2 during tests, because of frequent edits.
Post by Bináris
Hi,
I have
target = pywikibot.Page(site, uploadPage)
oldtext = target.get()
<long computing>
target.put(pretext + text, uploadComment)
pywikibot.exceptions.EditConflict: An edit conflict has occured.
So, is the likelihood of an edit conflict connected to elpased time
between instantiation and put(), or between get() and put()?
Is it useful to reinstantiate the page?
Is it useful to give a second chance to put() in case of edit conflict,
or loop it?
--
Bináris
--
Bináris
_______________________________________________
pywikibot mailing list
https://lists.wikimedia.org/mailman/listinfo/pywikibot
i***@gno.de
2018-02-17 14:10:04 UTC
Permalink
Hi Binaris,


be happy to get this EditConflict because the behaviour detecting it is not safe, see https://phabricator.wikimedia.org/T93364.

Anyway it is not a good idea to retry putting the page with the same modfied content because you will revert the previous edit. You have to get the new page content, modify it and save it afterwards. This means it would be better to skip the current edit and run the bot later again,


Best

Xqt
Post by Bináris
Hi,
I have
target = pywikibot.Page(site, uploadPage)
oldtext = target.get()
<long computing>
target.put(pretext + text, uploadComment)
pywikibot.exceptions.EditConflict: An edit conflict has occured.
So, is the likelihood of an edit conflict connected to elpased time between instantiation and put(), or between get() and put()?
Is it useful to reinstantiate the page?
Is it useful to give a second chance to put() in case of edit conflict, or loop it?
--
Bináris
_______________________________________________
pywikibot mailing list
https://lists.wikimedia.org/mailman/listinfo/pywikibot
Loading...