project8 / dripline

Slow controls for medium scale physics experiments based on AMQP centralized messaging
http://www.project8.org/dripline
1 stars 0 forks source link

add initial sets/cmds for a service #149

Closed laroque closed 8 years ago

laroque commented 8 years ago

It would be great if some initial sets/cmds could be defined for various endpoints in the config file for a service. This is specifically for actions that depend on the rest of the services objects being created/initialized. (For example, you can't start loggers until there is an active amqp connection object on which you can call the .add_timeout() method). These actions need to be run in Service.run, between Service.connect and Service._connection.ioloop.start() (ie, as late as possible while still being before the blocking call to start the loop.

Use cases:

  1. Endpoints which are loggers could start logging as soon as a service comes up, eliminating the need to manually start them
  2. Instruments like the mainframe muxer cards, which have a configurable state that is very important, could be told to initialize that state to something known, after is is guaranteed that all connections have been made and all other objects have been created and initialized. (for example, the muxer's endpoints exit and know their channel numbers and other configuration info)
laroque commented 8 years ago

Service now supports an input kwarg setup_calls that does this (merged into develop, not on a particular tag yet).