Skip to content

Commit 7830b63

Browse files
committed
compledted ioc_changes1
1 parent fa76e42 commit 7830b63

File tree

2 files changed

+85
-10
lines changed

2 files changed

+85
-10
lines changed

docs/user/tutorials/dev_container.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ for working on Generic IOCs from *outside* of the container. These commands
145145
are useful for debugging container builds: although most work is done inside
146146
the container, you will need these commands if it fails to build.
147147

148+
149+
.. note::
150+
151+
Before continuing this tutorial make sure you have not left the IOC
152+
bl01t-ea-ioc-02 running from a previous tutorial. Execute this command
153+
outside of the devcontainer to stop it:
154+
155+
.. code-block:: bash
156+
157+
ec ioc stop bl01t-ea-ioc-02
158+
148159
Once built, open the project in VSCode:
149160

150161
.. code-block:: bash

docs/user/tutorials/ioc_changes1.rst

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,32 @@ This is a type 1 change from `ioc_change_types`, types 2, 3 will be covered in t
66
following 2 tutorials.
77

88
Strictly speaking, Type 1 changes do not require a devcontainer. You created
9-
and deployed the IOC instance a previous tutorial without one. It is up to
9+
and deployed the IOC instance in a previous tutorial without one. It is up to
1010
you how you choose to make these types of changes. Types 2,3 do require a
1111
devcontainer because they involve compiling Generic IOC / support module code.
1212

1313
We are going to add a hand crafted EPICS DB file to the IOC instance. This will
1414
be a simple record that we will be able to query to verify that the change
1515
is working.
1616

17+
.. note::
18+
19+
Before doing this tutorial make sure you have not left the IOC
20+
bl01t-ea-ioc-02 running from a previous tutorial. Execute this command
21+
outside of the devcontainer to stop it:
22+
23+
.. code-block:: bash
24+
25+
ec ioc stop bl01t-ea-ioc-02
26+
1727
Make the following changes in your test IOC config folder
1828
(``bl01t/iocs/bl01t-ea-ioc-02/config``):
1929

2030
1. Add a file called ``extra.db`` with the following contents.
2131

2232
.. code-block:: text
2333
24-
record(ai, "BL01T-EA-IOC-01:TEST") {
34+
record(ai, "BL02T-EA-IOC-01:TEST") {
2535
field(DESC, "Test record")
2636
field(DTYP, "Soft Channel")
2737
field(SCAN, "Passive")
@@ -45,7 +55,7 @@ folder:
4555

4656
.. code-block:: bash
4757
48-
# stop the first IOC shell by hitting Ctrl-D or typing exit
58+
# stop any existing IOC shell by hitting Ctrl-D or typing exit
4959
cd /epics/ioc
5060
./start.sh
5161
@@ -57,7 +67,7 @@ from another terminal (VSCode menus -> Terminal -> New Terminal) like so:
5767

5868
.. code-block:: bash
5969
60-
caget $USER-EA-IOC-01:TEST
70+
caget BL02T-EA-IOC-02:TEST
6171
6272
If you see the value 1 then your change is working.
6373

@@ -82,24 +92,28 @@ committed and pushed to the bl01t repo. i.e.:
8292

8393
.. code-block:: bash
8494
85-
# Do this from the host terminal (not the devcontainer terminal)
95+
# Do this from a host terminal (not a devcontainer terminal)
8696
cd bl01t
8797
git add .
8898
git commit -m "Added extra.db"
8999
git push
90100
# tag a new version of the beamline repo
91101
git tag 2023.11.2
92102
git push origin 2023.11.2
103+
# deploy the new version of the IOC to the local docker / podman instance
93104
ec deploy bl01t-ea-ioc-02 2023.11.2
94105
95-
The above steps were performed on a host terminal because we are using ``ec``
96-
but all of the previous steps could have been done *inside* the devcontainer
97-
starting with ``cd /repos/bl01t``.
106+
The above steps were performed on a host terminal because we are using ``ec``.
107+
However all of the steps except for the ``ec`` command could have been done
108+
*inside* the devcontainer starting with ``cd /repos/bl01t``.
109+
110+
We choose not to have ``ec`` installed inside of the devcontainer because
111+
that would involve containers in containers which adds too much complexity.
98112

99113
Raw Startup Assets
100114
------------------
101115

102-
If you plan not to use `ibek` runtime asset creation you could use the raw
116+
If you plan not to use ``ibek`` runtime asset creation you could use the raw
103117
startup assets from the previous tutorial. If you do this then the process
104118
above is identical except that you will add the ``dbLoadRecords`` command to
105119
the end of ``st.cmd``.
@@ -113,5 +127,55 @@ The schema is in turn defined by the set of support modules that were compiled
113127
into the Generic IOC (ioc-adsimdetector). Each support module has an
114128
``ibek`` *support YAML* file that contributes to the schema.
115129

116-
The *Support yaml* files are in the folder ``/epics/ibek``
130+
The *Support yaml* files are in the folder ``/epics/ibek`` inside of the
131+
container. They were placed their during the compilation of the support
132+
modules at Generic IOC build time.
133+
134+
It can be instructive to look at these files to see what entities are available
135+
to *IOC instances*. For example the global support yaml file
136+
``/epics/ibek/ibek.yaml`` contains the following:
137+
138+
.. code:: yaml
139+
140+
- name: StartupCommand
141+
description: Adds an arbitrary command in the startup script before iocInit
142+
args:
143+
- type: str
144+
name: command
145+
description: command string
146+
default: ""
147+
pre_init:
148+
- type: text
149+
value: "{{ command }}"
150+
151+
- name: PostStartupCommand
152+
description: Adds an arbitrary command in the startup script after iocInit
153+
args:
154+
- type: str
155+
name: command
156+
description: command string
157+
default: ""
158+
post_init:
159+
- type: text
160+
value: "{{ command }}"
161+
162+
These two definitions allow you to add arbitrary commands to the startup script
163+
before and after iocInit. This is how we added the ``dbLoadRecords`` command.
164+
165+
If you want to specify multiple lines in a command you can use the following
166+
syntax for multi-line stings:
167+
168+
.. code-block:: yaml
169+
170+
- type: epics.StartupCommand
171+
command: |
172+
# loading extra records
173+
dbLoadRecords(config/extra.db)
174+
# loading even more records
175+
dbLoadRecords(config/extra2.db)
176+
177+
This would place the 4 lines verbatim into the startup script (except that
178+
they would not be indented - the nesting whitespace is stripped).
117179

180+
In later tutorials we will see where the *Support yaml* files come from and
181+
how to add your own.

0 commit comments

Comments
 (0)