Skip to content
Snippets Groups Projects

Send Kafka notifications when correction is complete

Merged Thomas Kluyver requested to merge send-kafka into master

Description

We're experimenting with the migration system sending Kafka notifications, including when migration has completed and a raw run is available on Maxwell ('event': 'migration_complete'). It would be nice to have similar notifications when a corrected run is available, and the calibration webservice is the obvious place to send those.

This is very minimal at the moment. It would be nice to send more information (migration events also have run directory, instrument & cycle), but this isn't easy without changing the sqlite database, which is a bigger change than I wanted to make at the moment. It could be extended to add events when correction starts, and events for characterisation (e.g. dark processing).

It will also need some work to handle multiple kinds of processing running on the same run. We probably want events when each piece of processing completes (with a robust way to identify which is which), and another event when everything that writes to proc/r0123/ has finished. But we shouldn't let the perfect be the enemy of the good, IMO.

How Has This Been Tested?

Run on max-exfl017, re-corrected a CALLAB run while listening for the event. This is the result I got:

{'event': 'correction_complete',
 'proposal': '900113',
 'run': '9998',
 'detector': 'lpd',
 'success': True}

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.

Reviewers

@danilevc @ahmedk

Merge request reports

Checking pipeline status.

Merged by Thomas KluyverThomas Kluyver 4 years ago (Mar 19, 2021 2:36pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • OK, with the latest change, it should now fail gracefully if it can't send Kafka notifications. I tested this by temporarily configuring the broker to no-such-server.desy.de, which it obviously can't connect to.

    I think this should work for any kind of problem with Kafka, but I don't know all the possible problems. We could make a more paranoid design where we put messages in a queue and interact with Kafka on a separate thread. I think that should be unncessary complexity (kafka-python is already using threads internally), but it might be worth keeping in mind if we have problems in the future.

    (I'm also now itching to refactor update_job_db and related functions, but I'll restrain myself for now. :-)

  • Thomas Kluyver resolved all discussions

    resolved all discussions

  • Thomas Kluyver added 1 commit

    added 1 commit

    Compare with previous version

  • Very nice and educational, LGTM :D

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading