Skip to content

Adjust testing environment #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"] # can add windows-latest, macos-latest
python: ["3.9", "3.10"] # Disable 3.11 until this is fixed:https://github.com/PandABlocks/PandABlocks-client/issues/47
python: ["3.10", "3.11"]
install: ["-e .[dev]"]
# Make one version be non-editable to test both paths of version code
include:
- os: "ubuntu-latest"
python: "3.8"
python: "3.10"
install: ".[dev]"

runs-on: ${{ matrix.os }}
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ name = "PandABlocks-ioc"
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
description = "One line description of your module"
dependencies = [
"setuptools>=64",
"numpy",
"click",
"h5py",
"softioc>=4.3.0",
"pandablocks>=0.3.1",
"pvi[cli]>=0.4",
"pvi>=0.5",
] # Add project dependencies here, e.g. ["click", "numpy"]
dynamic = ["version"]
license.file = "LICENSE"
Expand Down
5 changes: 4 additions & 1 deletion src/pandablocks_ioc/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

import click
from pandablocks.asyncio import AsyncioClient

from pandablocks_ioc.ioc import create_softioc

Expand Down Expand Up @@ -37,7 +38,9 @@ def softioc(host: str, prefix: str, screens_dir: str):
Connect to the given HOST and create an IOC with the given PREFIX.
Create .bob files for screens in the SCREENS_DIR. Directory must exist.
"""
create_softioc(host=host, record_prefix=prefix, screens_dir=screens_dir)
create_softioc(
client=AsyncioClient(host), record_prefix=prefix, screens_dir=screens_dir
)


# test with: python -m pandablocks_ioc
Expand Down
6 changes: 5 additions & 1 deletion src/pandablocks_ioc/_hdf_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ async def _handle_hdf5_data(self) -> None:
pipeline[0].queue.put_nowait(
EndData(captured_frames, EndReason.OK)
)

break
elif not isinstance(data, EndData):
raise RuntimeError(
f"Data was recieved that was of type {type(data)}, not"
"StartData, EndData, ReadyData or FrameData"
)
# Ignore EndData - handle terminating capture with the Capture
# record or when we capture the requested number of frames

Expand Down
5 changes: 2 additions & 3 deletions src/pandablocks_ioc/ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ async def _create_softioc(
create_softioc_task.add_done_callback(_when_finished)


def create_softioc(host: str, record_prefix: str, screens_dir: str) -> None:
def create_softioc(client: AsyncioClient, record_prefix: str, screens_dir: str) -> None:
"""Create a PythonSoftIOC from fields and attributes of a PandA.

This function will introspect a PandA for all defined Blocks, Fields of each Block,
and Attributes of each Field, and create appropriate EPICS records for each.

Args:
host: The address of the PandA, in IP or hostname form. No port number required.
client: The asyncio client to be used to read/write to of the PandA
record_prefix: The string prefix used for creation of all records.
"""
# TODO: This needs to read/take in a YAML configuration file, for various aspects
Expand All @@ -127,7 +127,6 @@ def create_softioc(host: str, record_prefix: str, screens_dir: str) -> None:

try:
dispatcher = asyncio_dispatcher.AsyncioDispatcher()
client = AsyncioClient(host)
asyncio.run_coroutine_threadsafe(
_create_softioc(client, record_prefix, dispatcher), dispatcher.loop
).result()
Expand Down
Loading