rtems-proxy 1.3.0b2__tar.gz → 1.3.0b3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/PKG-INFO +1 -1
  2. rtems_proxy-1.3.0b3/rtems-proxy.code-workspace +14 -0
  3. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/_version.py +3 -3
  4. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/telnet.py +32 -28
  5. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy.egg-info/PKG-INFO +1 -1
  6. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy.egg-info/SOURCES.txt +1 -0
  7. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.copier-answers.yml +0 -0
  8. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.devcontainer/devcontainer.json +0 -0
  9. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/CONTRIBUTING.md +0 -0
  10. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  11. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/ISSUE_TEMPLATE/issue.md +0 -0
  12. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -0
  13. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/copilot-instructions.md +0 -0
  14. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/pages/index.html +0 -0
  15. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/pages/make_switcher.py +0 -0
  16. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/_container.yml +0 -0
  17. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/_dist.yml +0 -0
  18. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/_pypi.yml +0 -0
  19. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/_release.yml +0 -0
  20. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/_test.yml +0 -0
  21. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/_tox.yml +0 -0
  22. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.github/workflows/ci.yml +0 -0
  23. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.gitignore +0 -0
  24. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.gitleaks.toml +0 -0
  25. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.pre-commit-config.yaml +0 -0
  26. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.python-version +0 -0
  27. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.vscode/extensions.json +0 -0
  28. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.vscode/launch.json +0 -0
  29. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.vscode/settings.json +0 -0
  30. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/.vscode/tasks.json +0 -0
  31. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/Dockerfile +0 -0
  32. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/LICENSE +0 -0
  33. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/README.md +0 -0
  34. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/pyproject.toml +0 -0
  35. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/renovate.json +0 -0
  36. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/requirements.txt +0 -0
  37. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/setup.cfg +0 -0
  38. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/__init__.py +0 -0
  39. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/__main__.py +0 -0
  40. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/configure.py +0 -0
  41. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/copy.py +0 -0
  42. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/globals.py +0 -0
  43. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/rsync.sh.jinja +0 -0
  44. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/trace.py +0 -0
  45. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy/utils.py +0 -0
  46. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy.egg-info/dependency_links.txt +0 -0
  47. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy.egg-info/entry_points.txt +0 -0
  48. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy.egg-info/requires.txt +0 -0
  49. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/src/rtems_proxy.egg-info/top_level.txt +0 -0
  50. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/tests/conftest.py +0 -0
  51. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/tests/test_cli.py +0 -0
  52. {rtems_proxy-1.3.0b2 → rtems_proxy-1.3.0b3}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rtems-proxy
3
- Version: 1.3.0b2
3
+ Version: 1.3.0b3
4
4
  Summary: Support for a K8S proxy container in controlling and monitoring RTEMS EPICS IOCs
5
5
  Author-email: Giles Knap <giles.knap@diamond.ac.uk>
6
6
  License: Apache License
@@ -0,0 +1,14 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ },
6
+ {
7
+ "path": "../i06-services"
8
+ },
9
+ {
10
+ "path": "../i04-services"
11
+ }
12
+ ],
13
+ "settings": {}
14
+ }
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '1.3.0b2'
32
- __version_tuple__ = version_tuple = (1, 3, 0, 'b2')
31
+ __version__ = version = '1.3.0b3'
32
+ __version_tuple__ = version_tuple = (1, 3, 0, 'b3')
33
33
 
34
- __commit_id__ = commit_id = 'g88e506f98'
34
+ __commit_id__ = commit_id = 'g4ee61374d'
@@ -89,7 +89,7 @@ class TelnetRTEMS:
89
89
  report("Cannot connect to remote IOC, connection in use?")
90
90
  raise CannotConnectError
91
91
 
92
- def check_prompt(self, retries=5) -> RtemsState:
92
+ def check_prompt(self, retries) -> RtemsState:
93
93
  """
94
94
  Determine if we are currently seeing an IOC shell prompt or
95
95
  bootloader. Because there is a possibility that we are in the middle
@@ -97,7 +97,7 @@ class TelnetRTEMS:
97
97
  """
98
98
  assert self._child, "must call connect before check_prompt"
99
99
 
100
- while retries > 0:
100
+ for retry in range(retries):
101
101
  try:
102
102
  # see if we are in the IOC shell
103
103
  sleep(0.5)
@@ -118,8 +118,7 @@ class TelnetRTEMS:
118
118
  report("Currently in IOC shell")
119
119
  return RtemsState.IOC
120
120
 
121
- report("Retrying get current status")
122
- retries -= 1
121
+ report(f"Retry {retry + 1} of get current status")
123
122
 
124
123
  report("Current state UNKNOWN")
125
124
  raise CannotConnectError("Current state of remote IOC unknown")
@@ -132,13 +131,13 @@ class TelnetRTEMS:
132
131
  assert self._child, "must call connect before reboot"
133
132
 
134
133
  report(f"Rebooting into {into.name}")
135
- current_state = self.check_prompt()
134
+ current_state = self.check_prompt(retries=2)
136
135
  if current_state == RtemsState.MOT:
137
136
  self._child.sendline("reset")
138
137
  else:
139
138
  self._child.sendline("exit")
140
139
 
141
- self._child.expect(self.CONTINUE, timeout=10)
140
+ self._child.expect(self.CONTINUE, timeout=30)
142
141
  if into == RtemsState.MOT:
143
142
  # send escape to get into the bootloader
144
143
  self._child.sendline(chr(27))
@@ -146,15 +145,7 @@ class TelnetRTEMS:
146
145
  # send space to boot the IOC
147
146
  self._child.send(" ")
148
147
 
149
- def wait_epics_prompt(self, timeout=50):
150
- if self._child is None:
151
- raise RuntimeError("Connection not established")
152
- expects: list[str] = self.FAIL_STRINGS + [self.IOC_STARTED]
153
- index = self._child.expect(expects, timeout=timeout) # type: ignore[arg-type]
154
- if index != len(self.FAIL_STRINGS):
155
- raise RuntimeError(f"IOC boot failed - output included '{expects[index]}'")
156
-
157
- def get_epics_prompt(self):
148
+ def get_epics_prompt(self, retries=5):
158
149
  """
159
150
  Get to the IOC shell prompt, if the IOC is not already running, reboot
160
151
  it into the IOC shell. If the IOC is running, do a reboot only if
@@ -162,17 +153,18 @@ class TelnetRTEMS:
162
153
  """
163
154
  assert self._child, "must call connect before get_epics_prompt"
164
155
 
165
- current = self.check_prompt()
166
- if current != RtemsState.IOC:
167
- sleep(0.2)
156
+ current = self.check_prompt(retries=10)
157
+
158
+ if current != RtemsState.IOC or (self._ioc_reboot and not self.ioc_rebooted):
159
+ sleep(0.5)
160
+ report("Rebooting the IOC")
161
+
168
162
  self.reboot(RtemsState.IOC)
169
163
  self.ioc_rebooted = True
170
- self.wait_epics_prompt()
171
- else:
172
- if self._ioc_reboot and not self.ioc_rebooted:
173
- self.ioc_rebooted = True
174
- self.reboot(RtemsState.IOC)
175
- self.wait_epics_prompt()
164
+
165
+ current = self.check_prompt(retries=10)
166
+ if current != RtemsState.IOC:
167
+ raise CannotConnectError("Failed to reboot into IOC shell")
176
168
 
177
169
  def get_boot_prompt(self):
178
170
  """
@@ -181,7 +173,7 @@ class TelnetRTEMS:
181
173
  """
182
174
  assert self._child, "must call connect before get_boot_prompt"
183
175
 
184
- current = self.check_prompt()
176
+ current = self.check_prompt(retries=10)
185
177
  if current != RtemsState.MOT:
186
178
  # get out of the IOC and return to MOT
187
179
  self.reboot(RtemsState.MOT)
@@ -203,6 +195,18 @@ class TelnetRTEMS:
203
195
  assert self._child, "must call connect before expect"
204
196
  self._child.expect(pattern, timeout=timeout)
205
197
 
198
+ def flush_remaining_output(self) -> None:
199
+ """
200
+ Flush any remaining buffered output to stdout.
201
+ Useful for displaying output before error reporting.
202
+ """
203
+ try:
204
+ if self._child:
205
+ self._child.read_nonblocking(size=8192, timeout=0.5)
206
+ except (pexpect.exceptions.TIMEOUT, pexpect.exceptions.EOF):
207
+ # no more output available, which is fine
208
+ pass
209
+
206
210
  def close(self):
207
211
  if self._child:
208
212
  self._child.close()
@@ -243,7 +247,7 @@ def ioc_connect(
243
247
  telnet.sendline("\r")
244
248
 
245
249
  if reboot:
246
- telnet.get_epics_prompt()
250
+ telnet.get_epics_prompt(retries=10)
247
251
  else:
248
252
  report("Auto reboot disabled. Skipping reboot")
249
253
 
@@ -253,8 +257,8 @@ def ioc_connect(
253
257
  raise
254
258
 
255
259
  except Exception as e:
256
- # still show the remaining output
257
- telnet.expect("_main_")
260
+ # flush any remaining buffered output to stdout
261
+ telnet.flush_remaining_output()
258
262
  report(f"An error occurred: {e}")
259
263
  telnet.close()
260
264
  if raise_errors:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rtems-proxy
3
- Version: 1.3.0b2
3
+ Version: 1.3.0b3
4
4
  Summary: Support for a K8S proxy container in controlling and monitoring RTEMS EPICS IOCs
5
5
  Author-email: Giles Knap <giles.knap@diamond.ac.uk>
6
6
  License: Apache License
@@ -9,6 +9,7 @@ README.md
9
9
  pyproject.toml
10
10
  renovate.json
11
11
  requirements.txt
12
+ rtems-proxy.code-workspace
12
13
  uv.lock
13
14
  .devcontainer/devcontainer.json
14
15
  .github/CONTRIBUTING.md
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes