-
Notifications
You must be signed in to change notification settings - Fork 115
Scheduled scans in scan server #3622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Scheduled scans in scan server #3622
Conversation
ActionButtonWidgetRuntime with scheduled scan support
|
As for the basic idea:
Seems like a good idea, with some questions: If I submit a ScheduledScan to run at 01:00, this means at around 01:00 it'll be submitted as a plain queued scan, right? If there's nothing else pending, it will start at 01:00, but if there's already something else running that takes 5 hours, the scan scheduled for 01:00 will wait in the queue until ~06:00, correct? If the scan server is restarted, any scheduled scans are lost just like any other queued scans are lost, correct? As for the implementation: Please use
That's bad. So far, we had no dependency between the display and the scan, and it should stay that way. |
Correct, unless you scheduled it and mark it as unqueued, in which case at 01:00 it will run in the "parallel executor" (same as the normal unqueued scans), regardless of what else is running. The default is queued, as it is with normal scan executions.
Yes, we discussed this internally as well, that it is probably nice if the database behind the scan server stores all scans, not just logged scans.
Will fix this, the reason I used
Alright, I will have a look at this. |
|
OK on the queued/non-queued behavior. Yes, the derby database could store commands as well as logged data, and that would allow restarts to keep the full scan info. If that's considered, it would be a separate project, so leave it as found for now.
Sorry, that was a bad idea. I was too shocked by some maven issue to think straight. Should all be |
|
A suggestion here was to use an SPI to be able to add context menu items to widget runtimes (this is what the added dependency was for), so that the scan client can register itself to action buttons for this scheduling. This saves us from having to use python scripts in every single action button for doing this kind of thing (which we preferably would not do). |
|
How do you submit a scan? Step 1 is that you need the scan commands. How do you assemble these? Typically, that requires a few parameters like start, end, ... values. |
|
Well, basically we'd like to just start a scan with a bunch of |
|
If you want a button in the display to submit a (scheduled) scan to |
|
Agreed that that dependency should go away, that's why perhaps using an SPI (where the scan client can register a menu item) might be a solution, though I could also remove this feature and keep it only for us internally. |
|
Yes, you can add the SPI into your site-specific product. You can easily grow that script to get the value or PV name from somewhere else. and now your script becomes a one-liner. |
|
I implemented the fixes / improvements you suggested and removed the dependencies. How we are going to add the task scheduling from the display runtime internally we shall see, perhaps with a python script, perhaps with some introspection magic, but it seems that it is not a great fit to upstream this in the end. I can squash some commits if you prefer? By the way, LocalDateTime is still used in other places (for example internally in the DateTimePane), but I didn't want to break anything. |
|
Thanks for updating to Instant! Inside the DateTimePane it makes sense to use LocalDateTime because the user should interact with the local time, but what comes out is then Can you revert the changes to |
I hope this change does not seem too strange, we are actually kind of curious how other facilities are using the scan server, as we think we might be using it in a strange way (more like a "scripting server"). Basically, we want to be able to schedule certain tasks (which are usually started by clicking a button, which triggers remote procedures through PV writes, but potentially also other more complex tasks), and we figured the scan server does almost everything that we want to do, besides scheduling. We added a new "scan type" (ScheduledScan), which behaves like a queued ExecutableScan until its execution time has come, when it is "resubmitted" to the scan engine as a normal ExecutableScan, and executed (either queued or not depending on what the user configured). So long as the scans are still scheduled, they are not blocking. I also made it so the progress indicates the leftover waiting time, and the execution time is shown in the "Command" field.
I decided to put the ScheduledScans in the same queue as the ExecutableScans and the LoggedScans, so the "usual" operations still work on them. It required an extra ScanState, which I also added to
scan.dbin the examples folder as the comment seemed to suggest (?). I am not sure how to test if that still works. This change also adds some dependencies from the display runtime on the scan server (to add a "schedule task" context menu to ActionButtons with WritePV-type actions).Again, we are very curious if this is something other facilities might like, and how the scan server is being used in general. Perhaps you have another suggestion to execute scheduled tasks with something that is already in phoebus, if you do not deem this a good fit for the scan server. The commits labeled
[phoebus]are just fixes / improvements that may be cherrypicked into main anyway, and are unrelated to the scheduling, though related to the scan server.Checklist
Testing:
Documentation: