Jump to content

User:Ottomata/Manual MediaWiki Job Submission

From Wikitech

Example of POSTing a NullJob event to EventGate, and watching MediaWiki run it.

job.json:

{
  "$schema": "/mediawiki/job/1.0.0",
  "meta": {
    "stream": "mediawiki.job.null",
    "domain": "test.wikipedia.org",
    "request_id": "otto-jobtest-1"
  },
  "database": "testwiki",
  "type": "null",
  "params": {
    "lives": 3,
    "marker": "otto-jobtest-1"
  }
}

lives is the number of times NullJob will resubmit itself. Each run sends a new event with lives one lower.


Tail the job topic:

kafkacat -C -b kafka-main1006.eqiad.wmnet:9092 -t eqiad.mediawiki.job.null -o end

POST the NullJob event to eventgate-main:

curl -H 'content-type: application/json' \
  --data-binary @job.json \
  https://eventgate-main.discovery.wmnet:4492/v1/events

201 means that EventGate sent the event to Kafka.

Watch the kafkacat output. You should see events with "lives": 3 then two more events, with "lives": 2 and "lives": 1. MediaWiki NullJob makes these events, so they indicate that JobExecutor ran your job.