[INSTRM-1415] Add visit0 logic to IIC Created: 23/Oct/21 Updated: 14/Jan/22 Resolved: 14/Jan/22 |
|
| Status: | Done |
| Project: | Instrument control development |
| Component/s: | ics_iicActor |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | cloomis | Assignee: | arnaud.lefur |
| Resolution: | Done | Votes: | 0 |
| Labels: | EngRun | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Story Points: | 2 | ||||||||
| Sprint: | PreEngRun4 | ||||||||
| Reviewers: | Kiyoto Yabe | ||||||||
| Description |
|
We want the SPS, FPS/MCS, and AGC visits to be synchronized by PFI convergence: for the visit used for the `fps moveToPfsDesign` command to be the one which starts that field's SPS and AGCC visits. |
| Comments |
| Comment by arnaud.lefur [ 23/Oct/21 ] |
|
This logic has also to take into account that contrary to fps, other lightSource config change(dcb bundles, sunss pointing) is not necessarily associated with a visit. |
| Comment by arnaud.lefur [ 15/Nov/21 ] |
|
okay, so that's 90% done, but I'm hitting an opdb issue that cannot be worked around. But since we're sharing pfs_visit_id among fps,sps,agc, and have a visit_set_id, for one of those, you want to insert several sequence for a given visit which break the constraint. One solution is to
This way, you keep the unicity of pfs_visit_id,visit0 in visit_set but different iic_sequence can share the same visit0 In this case, renaming visit_set_id to sequence_id would probably make more sense, but do we care ? I'm not sure. |
| Comment by arnaud.lefur [ 15/Nov/21 ] |
|
okay last proposal after discussions with cloomis and rhl.
I'm pulling opdb table from the summit and preparing a script to do those schema changes which I will hand off to Kiyoto Yabe when I'm sure it's doing the right thing. |
| Comment by Kiyoto Yabe [ 15/Nov/21 ] |
|
That seems to be probably reasonable to me. `sequence_id` is totally different from `status_sequence_id` right? Can we make it as `iic_sequence_id` to avoid any confusion? A script for the schema change would be very helpful, but I prefer to make the actual change through the alembic mechanism after fixing `models.py`. This change probably affects the `obslog` so I took the liberty of inviting michitaro for further discussion. |
| Comment by arnaud.lefur [ 16/Nov/21 ] |
|
in the end, that scheme was again not quite right, we're confusing the official visit0 with the first visit of the visit_set which is sometimes equivalent but sometimes not. the final proposal is actually much less disruptive than the previous one which is always good. we're adding a field_set table :
|
| Comment by arnaud.lefur [ 16/Nov/21 ] |
|
I also add to add a unique constraint on pfs_config.visit0 otherwise it's complaining the foreign key is not unique : ProgrammingError: (psycopg2.errors.InvalidForeignKey) there is no unique constraint matching given keys for referenced table "pfs_config" I check a bit more, it's true that currently there is no explicit unique contraint : CONSTRAINT pfs_config_pkey PRIMARY KEY (pfs_design_id, visit0),
CONSTRAINT pfs_config_pfs_design_id_fkey FOREIGN KEY (pfs_design_id)
REFERENCES public.pfs_design (pfs_design_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
compared to CONSTRAINT pfs_config_pkey PRIMARY KEY (pfs_design_id, visit0),
CONSTRAINT pfs_config_pfs_design_id_fkey FOREIGN KEY (pfs_design_id)
REFERENCES public.pfs_design (pfs_design_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT pfs_config_visit0_key UNIQUE (visit0)
I'm a bit confused about using _table_args_ to pass contraints, it's look like it's not completely equivalent to declare a column unique. |
| Comment by Kiyoto Yabe [ 17/Nov/21 ] |
|
Changes look fine to me. |
| Comment by hassan [ 19/Nov/21 ] |
|
Yabe-san has approved the changes. |