driplineorg / dripline-python

python implementation of project8/dripline
Apache License 2.0
3 stars 6 forks source link

Service startup commands #136

Open nsoblath opened 3 years ago

nsoblath commented 3 years ago

Users should be able to configure a service with a set of startup commands. dl-serve should read startup commands from the config file and use concurrent_receiver::process_message() to add the messages into the processing queue before starting the service.

We probably need to bind concurrent_receiver and add that to the specifications of service's bound base classes.

nsoblath commented 3 years ago

As of driplineorg/dripline-cpp#79 (currently in the develop branch), the C++ supports adding commands to a service prior to service startup using the service::process_message() interface.

Now we need support in the Python binding to use that interface, and in the Python to implement an interface.

raphaelcervantes commented 3 years ago

@nsoblath I can think of a minimal implementation of setup_calls based on this dragonfly example: https://github.com/project8/dragonfly/blob/75848c86fa117291687b7404dd3b1f36394393a4/examples/kv_store_tutorial.yaml#L41

So the configuration file should look something like

runtime-config:
  name: my_store
  module: Service
  auth_file: /root/authentications.json
  endpoints:
        - name: peaches
          module: KeyValueStore
          calibration: '2*{}'
          initial_value: 0.75
          log_interval: 10
          get_on_set: True
          log_on_set: True
        - name: chips
          module: KeyValueStore
          calibration: 'times3({})'
          initial_value: 1.75
        - name: waffles
          module: KeyValueStore
          #log_interval: 30
          #log_on_set: True
          calibration: '1.*{}'
          initial_value: 4.00
setup_calls:
  - target: peaches
    method: on_set
    args: 3.1