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

mantis interface request interval determination #122

Closed laroque closed 8 years ago

laroque commented 9 years ago

I saw that in slack there was some discussion about what the "right" way to determine the interval for sending requests to mantis are. I'll summarize how it currently works and why, then welcome comments.

First there is a base DAQProvider class which implements three important methods:

Next, each there is a class which inherits from DAQProvider for each DAQ system. They override the parent start_run() and end_run() but are expected to use super() to still call the parent methods. This means each interface implements whatever actually needs to happen but the above behaviors are done the same across all DAQ systems.

In the case of the interface for mantis, the class also inherits from core.Spime (which allows it to behave like a sensor logger). The "logging" action for mantis is configured to be sending an OP_RUN to the mantis queue with appropriate parameters. This results in in an OP_RUN being sent every log_interval seconds. Aside from some unfortunate names (like log_interval) this is nice because it uses the same code and pika based asynchronous callback system to take care of timing those events (which means there aren't any blocking calls to things with long while loops or ugly threading blocks to deal with).

Other considerations:

nsoblath commented 9 years ago

I think we should consider the other side of the issue, what would be ideal considering the way that Mantis and the digitizer function, and then we can determine the best way to implement it.

Mantis's mode of operation is to run for a fixed amount of time to create a single data file (originally this was the sense of a "run," though now a run can consist of multiple of such files). We can consider how we would want to perform both timed and untimed runs:

The DAQ interface can set the acquisition time in mantis, so we don't have to worry about the mantis settings not being synchronized with the interface settings. Furthermore, that allows us to change the acquisition time between acquisitions if that's appropriate.

Here are my thoughts on how I would implement the two modes in the DAQ interface. These are what I think I would ideally want, and therefore they might not take into account some of the considerations you mentioned above:

laroque commented 9 years ago

Okay, so some follow up thoughts:

For the untimed case. Do you mean that the time between requests being sent L == Y - epsilon; or that L == Y, starting with the time between runs 1 and 2, but that between run 0 and run 1 the time is somewhat less than L? The former case seems like it could really build up over something like an overnight run; the latter case is basically what I had suggested above (take to the extreme where that first time delta is 0).

I guess my concerns was something more like: "If in both timed and untimed cases, what we really want is more-or-less continuous data, is it reasonable that one case works in a way that could be more continuous than the other?" If it ever matters then this seems like a potential gotcha that we will screw up in the future.

For the end_run() cancel stuff. What is the current mantis_server API.

nsoblath commented 9 years ago

For the untimed case, I definitely meant that starting between runs 1 and 2 L==Y, but that between 0 and 1, L < Y. I don't know if that fits with the setup that's currently used, where the DAQ interface for mantis behaves like a logger.

Acquisitions are referenced by a UUID that gets assigned when the acquisition request is received, and is sent in the reply to that request.

Currently the Mantis API includes the ability to dump all acquisition requests, or to cancel individual requests (keyed by the UUID).

The broadcast about completed files is there. One just needs to specify the completed-file-key in the server config. This is left un-set by default, which turns it off. I hadn't actually thought of that as a way to limit the list of acquisitions that would need to be canceled, but that would work perfectly.

laroque commented 9 years ago

I've implemented the untimed-case which I think is consistent with both of our suggestions (based on my note-to-self in the original issue description). The model will be that when you start_run() an acquisition request is sent immediately, then "logging_status" is set to on, which sends an acquisition request immediately, and then another ever log_interval seconds.

The result is that acquisition request 1 is send epsilon seconds after acquisition request 0. For all i>1, acquisition request i is sent log_interval seconds after acquisition request i-1.

Remaining items are:

nsoblath commented 9 years ago

Based on our discussion today on Slack, all of this sounds good.

For the record, I raised a question about whether we should be using stop-all when mantis can receive input from multiple sources and regarding different run configurations. We agreed that this amount of freedom is bad, considering that there is only a single run queue, and requests are all handled serially, regardless of the source. There is now a feature request for Mantis regarding a lockout feature, but for now we'll rely on the small number of people using Mantis maintaining good practices, and only having one user of Mantis at a time.

laroque commented 8 years ago

merged into develop from feature/mantis_interface_update branch in 7646b0c039285