Crawl pvi screens - #272
tomkane-dls wants to merge 7 commits into
Conversation
e0385bd to
49aec7e
Compare
The test fetched a screen from a real beamline's opis server, which meant the hostname, IOC and PV prefix appeared in the test and the screens it crawled were not in the repo. Crawl the t01 motor IOC's index.bob instead: it is already checked in under tests/t01-services and links on to three sub-screens, so it covers the same behaviour without any new fixtures.
#273 moved WidgetType to utils.py; the crawl module and its tests were still reaching it through jsonmap.links, which only re-imports it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #272 +/- ##
==========================================
+ Coverage 96.23% 96.25% +0.02%
==========================================
Files 17 17
Lines 1088 1094 +6
==========================================
+ Hits 1047 1053 +6
Misses 41 41 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
When running this against i19-services, some files get malformed file paths, e.g. for S3: "file": "techui-support/bob/slits/slit-4axis.bob",
"children": [
{
"file": "techui-support/bob/slits/slit-4axis-individual-embed.bob",
"children": [
{
"file": "techui-support/bob/pmac/$(IOC)/pmacAxis.pvi.bob", <-----------
"exists": false,
"macros": {
"P": "BL19I-AL-SLITS-03",
"M": ":Y:POS",
"IOC": "$(IOC)",
"label": "Y Pos"
},
"displayName": "X Center"
}, |
|
A similar thing happens with DCM.bob (NOTE: a validated screen) on i19-services: "file": "DCM.bob",
"children": [
{
"file": "techui-support/bob/pmac/https:/i19-opis.diamond.ac.uk/bl19i-mo-dcm-01/pmacAxis.pvi.bob", <--------
"exists": false,
"macros": {
"P": "BL19I-MO-DCM-01",
"M": ":BRAGG",
"label": "BRAGG",
"IOC": "https://i19-opis.diamond.ac.uk/bl19i-mo-dcm-01"
},
"displayName": "BRAGG" |
|
A bit more context, as i understand it -the changes here in this PR would remove all references to the opis url. I will refer to them as generated screens, as within this context nothing is really 'remote' from techui-builders perspective. All paths, to locally created screens (like for example - from inside <file>techui-support/bob/pmac/motor_embed.bob</file>
<macros>
<M>:Z</M>
<P>BL01C-MO-SPEC-01</P>
<label>Z</label>
<IOC>../../../../bl01c-mo-ioc-01</IOC>
</macros>When this is ran in kubernetes on ioc startup, all the generated screens from other services are mounted in the pod, so techui-builder can crawl everything locally inside the opis/ folder which has this structure: The relative paths are put into entries for every screen in the JsonMap. Daedalus can then navigate in the same way relatively, seeing the same structure as inside the opis/ above from its entry point: With absolute paths, we would need to fetch the screens generated by other services to be able to crawl them, otherwise we can only tell daedalus about the first screen (like With relative paths this does mean that when running techui-builder locally we will not find any of the generated screens as they are not contained in |
hmm I would have expected this to become like the below - i will investigate why this isnt happening here "file": "DCM.bob",
"children": [
{
"file": "techui-support/bob/pmac/pmacAxis.pvi.bob", <--------
"exists": false,
"macros": {
"P": "BL19I-MO-DCM-01",
"M": ":BRAGG",
"label": "BRAGG",
"IOC": "../../../../bl19i-mo-dcm-01"
},
"displayName": "BRAGG" |
|
Ok i didn't encounter these problems as they are not present on b01-1 or in t01 example. DCM/Validated screens S3/Screens using autofill - note i don't see S3 but assuming its the same as S1 macros:
P: BL19I-AL-SLITS-01
IOC: ../../../../bl19i-mo-ioc-01 <-----I haven't tested this yet, so i will check these fixes work as i say they do |
|
Okay yes i believe the above fixes, adding an IOC macro in techui.yaml for the slits (if we are happy with this as a fix if choosing to bypass the generator) and regenerating validated screens both work when i tested locally: DCM: {
"file": "DCM.bob",
"children": [
{
"file": "../bl19i-mo-dcm-01/pmacAxis.pvi.bob",
"macros": {
"M": ":BRAGG",
"P": "BL19I-MO-DCM-01",
"label": "BRAGG",
"IOC": "../../../../bl19i-mo-dcm-01"
},
"displayName": "BRAGG"
},SLITS: "file": "techui-support/bob/slits/slit-4axis-individual-embed.bob",
"children": [
{
"file": "../bl19i-mo-ioc-01/pmacAxis.pvi.bob",
"exists": false,
"macros": {
"P": "BL19I-AL-SLITS-01",
"IOC": "../../../../bl19i-mo-ioc-01",
"M": ":Y:POS",
"label": "Y Pos"
},
"displayName": "X Center"
}, |
|
Ah yeah, if you look in techui-builder/src/techui_builder/validator.py Lines 106 to 119 in 2dd3dc6 |
@OCopping I am busy on the ViSR sprint from now, so i won't have time to have a look at the validator stuff currently. If you could look at it that would be great - do you think that belongs on another PR or on this one? |
produce a correct tree by resolving links like Phoebus does
The main result of this PR is jsonmap entries now look like this:
removing the generate-jsonmap command from the CI of b01-1-services has allowed for total removal of any URLs. A beta version is deployed on b01-1
Changes:
All specific references to pvi/remote screens are gone, they are simply resolved relative to the entry point as seen above. PVI regex is gone, beamline_url is no longer used, any refernces to urls dropped. The
$(IOC)macro maybe could have a better name something like$(service_dir)?resolve_link() expands macros in the link text and resolves the result relative to the screen containing the link. This replaces resolve_link_path/find_local_screen, which matched $(IOC)/ with a regex and resolved everything against a fixed link_base_dir using the component's service name.
Macros inherit down the crawl — CrawlContext now carries the screen being crawled and the accumulated macros - inherit_macros() expands a link's macro values against the parent's before overriding. Previously macros were only attached to the resulting node, never used for resolution. CrawlContext.with_screen_component became with_screen and service_name is gone.
ScreenNode.duplicate removed as it is unused.