Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Enable configuration of scheduled automation jobs for instrument controllers #230

Merged
merged 10 commits into from
Mar 16, 2023

Conversation

ethanjli
Copy link
Member

@ethanjli ethanjli commented Mar 14, 2023

This PR closes #215 and begins making progress on #231 by adding functionality to schedule an arbitrary number of recurring automation jobs on an instrument; the scheduling parameters are interval and start time (so it's possible to run a job at the start of every minute, for example, or just starting immediately and with an interval of 60 seconds). Each job is scoped to the instrument which the job is bound to. For this PR, a job consists of a single linear sequence of actions (to run the pump with the specified flowrate and volume and direction, to stop the pump, or to wait for some duration) on all Planktoscope controllers which match a name specified in the action (and which are bound to the instrument).

In the future, it could also be possible to, for example:

  • provide an action to make the Planktoscope perform a stop-flow data acquisition sequence
  • provide an action to enable or disable a controller, camera, or automation job

However, such extensions are currently out-of-scope of currently required functionalities.

Features:

  • Automation jobs can be added to any instrument; the job is specified using a minimal HCL2 syntax. Currently errors are only reported in the server's console logs. Here's an example configuration for a job on an instrument which has a controller named planktoscope; it repeatedly runs the pump for 5 seconds and then stops the pump for 5 seconds:
schedule {
  interval = "10s"
  start = "2023-01-01T00:00:00-07:00"
}

action "controller "start-pumping" {
  controller = "planktoscope"
  command = "pump"
  forward = true
  volume = 10 # mL
  flowrate = 0.1 # mL/min
}

action "sleep" "wait-pumping" {
  duration = "5s"
}

action "controller" "stop-pumping" {
  controller = "planktoscope"
  command = "stop-pump"
}

And here's what the GUI looks like (this is bottom section of the instrument page):
screenshot

  • Optional names and descriptions can now be set for instrument cameras, controllers, and automation jobs. These names and descriptions are only visible to the instrument administrator and only useful for assigning names to controllers for referring to them in automation jobs; though in the future it would be possible to display descriptions together with cameras (for example) when multiple cameras are enabled.

Fixes:

  • The enabled columns in the instrument camera and controller tables now have not null constraints, with a default value of false.
  • When the server starts, it will only make Planktoscope MQTT clients for controllers flagged as enabled in the database.

@ethanjli ethanjli added stage: dev On/for a development version type: feature Brand new functionality, features, pages, workflows, endpoints, etc. labels Mar 14, 2023
@ethanjli ethanjli changed the title Enable configuration of scheduled automation actions for instrument controllers Enable configuration of scheduled automation jobs for instrument controllers Mar 14, 2023
@ethanjli ethanjli marked this pull request as ready for review March 16, 2023 05:14
@ethanjli ethanjli merged commit d647790 into main Mar 16, 2023
@ethanjli ethanjli deleted the feature/instrument-controller-automation branch March 16, 2023 05:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stage: dev On/for a development version type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add configurable automation of instruments
1 participant