MediaWiki Job Queue: Difference between revisions

From WikiMLT
Line 8: Line 8:
IP="/var/www/wiki.example.com" # The DocumentRoot directory of the wiki
IP="/var/www/wiki.example.com" # The DocumentRoot directory of the wiki
OWNER="www-data"              # The user that owns the $IP directory
OWNER="www-data"              # The user that owns the $IP directory
BRANCH="REL1_39"              # The MediaWiki's branch in use
</syntaxhighlight>
</syntaxhighlight>
==Show Jobs==
==Show Jobs==
<syntaxhighlight lang="shell" line="1" class="code-continue">
<syntaxhighlight lang="shell" line="1" class="code-continue">
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php"
</syntaxhighlight><syntaxhighlight lang="bash" class="code-continue">
15    # The count of the all pending jobs
</syntaxhighlight><syntaxhighlight lang="shell" line="1" class="code-continue">
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --group
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --group
</syntaxhighlight><syntaxhighlight lang="shell-session" class="code-continue">
</syntaxhighlight><syntaxhighlight lang="shell-session" class="code-continue">
Line 30: Line 33:
</syntaxhighlight><syntaxhighlight lang="shell" line="1" class="code-continue">
</syntaxhighlight><syntaxhighlight lang="shell" line="1" class="code-continue">
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --type cirrusSearchLinksUpdatePrioritized
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --type cirrusSearchLinksUpdatePrioritized
</syntaxhighlight><syntaxhighlight lang="shell-session" class="code-continue">
</syntaxhighlight><syntaxhighlight lang="bash" class="code-continue">
2    # the number of the pending jobs for the specified type
2    # The count of the pending jobs for the specified --type
</syntaxhighlight>If it is a wiki family, you may need to specify the <code>$wikiId</code>, like below.<syntaxhighlight lang="shell" line="1" class="code-continue">
</syntaxhighlight>If it is a wiki family, you may need to specify the <code>$wikiId</code>, like below.<syntaxhighlight lang="shell" line="1" class="code-continue">
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --wiki="${wikiId}"
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --wiki="${wikiId}"
</syntaxhighlight>
</syntaxhighlight>
== Manage Jobs ==
Re-push abandoned jobs of certain type.<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray">
sudo -u ${OWNER} php "${IP}/maintenance/manageJobs.php" --type typeName --action "repush-abandoned"
</syntaxhighlight>Delete Jobs of certain type. <syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray">
sudo -u ${OWNER} php "${IP}/maintenance/manageJobs.php" --type typeName --action "delete"
</syntaxhighlight>Use <code>showJobs.php --group</code>, as it is shown above, to find available job types in the current job queue. Note the quote marks at the action options in the examples above are used here just for better highlight.
==References==
==References==


*MediaWiki: [[mw:Manual:Job queue|Manual:Job queue]] (Continuous service)
*Continuous service examples:
*MediaWiki: [[mw:Manual:showJobs.php|Manual:showJobs.php]]
**MediaWiki: [[mw:Manual:Job queue|Manual:'''Job queue''']]
**Semantic MediaWiki: [[smw:Help:Job queue|Help:Job queue]]
*MediaWiki: [[mw:Manual:runJobs.php|Manual:'''runJobs.php''']]
*MediaWiki: [[mw:Manual:showJobs.php|Manual:'''showJobs.php''']]
*MediaWiki: [[mw:Manual:manageJobs.php|Manual:'''manageJobs.php''']]
*MediaWiki Docs: [https://doc.wikimedia.org/mediawiki-core/master/php/group__JobQueue.html JobQueue]
*MediaWiki Support desk: [[mediawikiwiki:Topic:Tro0r1cvufe9juol|How to remove abandoned jobs from job queue?]]


<noinclude>
<noinclude>

Revision as of 17:15, 5 March 2023

I'm writ­ing this ar­ti­cle at the time while mi­grat­ing this wi­ki from Me­di­aWi­ki ver­sion 1.38 to ver­sion 1.39. Ac­cord­ing to the Cir­rusSearch extension's page and I was in need to mi­grate from Elas­tic­search ver­sion 6.8.23 to ver­sion 7.10.2.

So af­ter in­stalling Elas­tic­search ver­sion 7.10.2, in­stead fol­low­ing the Up­grade man­u­al I've Re­build the Elas­tic­search da­ta from scratch which leads me to an in­fi­nite MediaWiki's Job queue. For this rea­son I was need to get much fa­mil­iar with the MediaWiki's main­te­nance scripts re­lat­ed the Job queue.

Envvars

The en­vi­ron­ment vari­ables used in the fol­low­ing com­mands.

IP="/var/www/wiki.example.com" # The DocumentRoot directory of the wiki
OWNER="www-data"               # The user that owns the $IP directory

Show Jobs

sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php"
15    # The count of the all pending jobs
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --group
cirrusSearchLinksUpdatePrioritized: 2 queued; 0 claimed (0 active, 0 abandoned); 0 delayed
htmlCacheUpdate: 4 queued; 0 claimed (0 active, 0 abandoned); 0 delayed
recentChangesUpdate: 1 queued; 0 claimed (0 active, 0 abandoned); 0 delayed
refreshLinksDynamic: 7 queued; 0 claimed (0 active, 0 abandoned); 0 delayed
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --group
cirrusSearchLinksUpdatePrioritized MediaWiki_Job_Queue addedLinks=[] removedLinks=[] prioritize=1 cluster= namespace=0 title=MediaWiki_Job_Queue requestId=ZASOXkzdk5n0fxsD5JVbLgAAQRA (id=6794955,timestamp=20230305124311) status=unclaimed
...
htmlCacheUpdate MediaWiki_Job_Queue table=templatelinks recursive=1 rootJobIsSelf=1 rootJobSignature=fcd541151cba4e3ac5b300da797a3163c93407bc rootJobTimestamp=20230305124311 causeAction=page-edit namespace=0 title=MediaWiki_Job_Queue requestId=ZASOXkzdk5n0fxsD5JVbLgAAQRA causeAgent=unknown (id=6794956,timestamp=20230305124311) status=unclaimed
...
recentChangesUpdate Special:RecentChanges type=cacheUpdate namespace=-1 title=RecentChanges requestId=ZASOUUzdk5n0fxsD5JVa-QAAUQs (id=6794954,timestamp=20230305124307) status=unclaimed
refreshLinksDynamic Kali_Linux_Install_GUFW_(gui-ufw) isOpportunistic=1 rootJobTimestamp=20230305121652 namespace=0 title=Kali_Linux_Install_GUFW_(gui-ufw) requestId=ZASIM9BBdr0qUp1CuMirLwAAABA causeAction=unknown causeAgent=unknown (id=6794945,timestamp=20230305121653) status=unclaimed
...
sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --type cirrusSearchLinksUpdatePrioritized
2    # The count of the pending jobs for the specified --type

If it is a wi­ki fam­i­ly, you may need to spec­i­fy the $wiki­Id, like be­low.

sudo -u ${OWNER} php "${IP}/maintenance/showJobs.php" --wiki="${wikiId}"

Man­age Jobs

Re-push aban­doned jobs of cer­tain type.

sudo -u ${OWNER} php "${IP}/maintenance/manageJobs.php" --type typeName --action "repush-abandoned"

Delete Jobs of cer­tain type.

sudo -u ${OWNER} php "${IP}/maintenance/manageJobs.php" --type typeName --action "delete"

Use showJobs.php –group, as it is shown above, to find avail­able job types in the cur­rent job queue. Note the quote marks at the ac­tion op­tions in the ex­am­ples above are used here just for bet­ter high­light.

Ref­er­ences