Create UKKID Controller agent - #1083
Conversation
…hanges to g3 file being written out with observation and wiring frames
…ols. Note - note complete at the moment.
… and should work with standard workflow.
…ufm_kid1 or ufm_kid2
for more information, see https://pre-commit.ci
BrianJKoopman
left a comment
There was a problem hiding this comment.
Thanks for PRing this @wenlockedge, and apologies it took so long to get to. Lots of comments below. I'm happy to help addressing some of them, like the packaging bits.
There was a problem hiding this comment.
Let's not commit a 49 MB .csv file here. That ~doubles the size of cloning this entire repo.
There was a problem hiding this comment.
Hi,
Yes, it makes sense to only allow actual code, rather than ancillary data files, in the repo. However, this file is required for the code to work properly in mocked mode. Do you have a recommendation for the best place for it can go such that it is publicly accessible and can be downloaded by someone following the install procedure in README.md? Something like a personal google drive/dropbox/ or git repo doesn't seem like the right solution...
|
|
||
| 2. souk_readout_tools. This is the python code for the readout client | ||
| described above (note this repository also contains the code for the | ||
| readout server software that runs on the RFSoCs). **Use branch main** |
There was a problem hiding this comment.
The "Use branch main" conflicts with "Be sure to select branch dev/1.3.0 from the pull down menu on github before cloning this repository." below. Which branch is recommended?
| The way I am doing this (there may be a more elegant way) is to create a soflink from the default "agents" directory in your default OCS installed to point at the | ||
| ukkid_controller directory within the SOCS directory tree. On my system I had installed ocs in /home/leechj/ocs and socs in /home/leechj/socs, so I did. |
There was a problem hiding this comment.
Yes, there is a more elegant way. ocs is capable of launching any agent registered with a given 'ocs plugin'. socs is an ocs plugin. All agents within socs are 'registered' in the file plugin.py.
So a few recommendations to match the standards already in place in socs are:
- Rename
ukkid_controller.pytoagent.py. (Just for consistency really.) - Add a line in
plugin.pyfor theUKKIDController. - Create an
__init__.pyfile insocs/socs/agents/ukkid_controller/. This makes a regular package that can be imported. This'll be a blank file.
Once you do this, remove this whole "Making the UKKID_controller.py agent available to your OCS install" section.
| 1. An Observatory Control System (OCS) installation. | ||
|
|
||
| 2. souk_readout_tools. This is the python code for the readout client | ||
| described above (note this repository also contains the code for the | ||
| readout server software that runs on the RFSoCs). **Use branch main** | ||
| for compatibility with the ukkid_controller agent. | ||
|
|
||
| 3. The ukkid_controller agent itself - i.e. everything within the | ||
| agents/UKKIDcontroller directory. This can be obtained by checking out | ||
| the "ukkid_agent" branch of the official "socs" Simons Observatory | ||
| repository. |
There was a problem hiding this comment.
This might make sense for a guide on Confluence or similar, but 1 and 3 don't really make sense to include in this context. ocs is a requirement for socs (i.e. it gets installed by the socs installation automatically. And the ukkid_controller agent is getting packaged into socs -- of course it's included.
| while self.client.get_info(['server'])[0]['latest_sweep_data_valid'] is False: | ||
| self.log.info('Waiting for scan to complete, sleeping for 1 second.') | ||
| time.sleep(1) |
There was a problem hiding this comment.
What if the server never reports a valid sweep? Seems like we could get stuck here if there's an issue on the server end.
| def _abort_narrow_band_sweep(self, session, params): | ||
| if session.status == 'running': | ||
| session.set_status('stopping') | ||
|
|
||
| if session.status != 'running': | ||
| return False, 'Aborted narrow band sweep data.' |
There was a problem hiding this comment.
Like the others, this aborter doesn't do anything unless the task handles the change in status appropriately.
| self.log.info('Accurate Frequencies extracted from ' + f_accurate_filename) | ||
|
|
||
| # At this point. f_accurate_list should defined. | ||
| self.log.info('set_tone_frequencies: Will use tone frequencies of ' + str(f_accurate_list)) |
There was a problem hiding this comment.
How long is this list in practice?
| # JL write something to the feed here? | ||
| return True, 'set_tone_frequencies: complete.' | ||
|
|
||
| def get_tone_frequencies(self, session, params=None): |
There was a problem hiding this comment.
How are these 'get_X' tasks used in practice?
There was a problem hiding this comment.
I've left some of these as detailed comments below, but some general comments:
- You don't need to/shouldn't publish log style messages to the feed. Things like "Expected key f_guess_list not found in json file..." don't need to be kept forever in the .g3 file archive. That's more appropriate as a log message. They're useful when that message just occurred, but less so on data that's years old.
- You probably don't need to put those types of log messages into
session.dataeither. Some sort of 'status' key/value like'streaming: True'makes sense, but long log messages fit better in the stdout log. - There's a lot of 'go find the latest relevant file' code in this agent, which would probably make more sense to abstract away to either a 'driver module' or to the
souk_readout_toolspackage. This doesn't have to happen now, but it would clean up the agent a bit to do it eventually.
Creating a pull request as request by Brian Koopman on 10 July 2026.
Description
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: