Skip to content

Commit

Permalink
Add default master file (#12)
Browse files Browse the repository at this point in the history
* adds master file example

* updates dockerfile

* adds path to default master file

* updates README

* update readme

* bump version
  • Loading branch information
fhernandezvivanco authored Sep 11, 2024
1 parent 269ade5 commit 45168b5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM python:3.12

ENV AS_HDF5_MASTER_FILE=/share_data/datasets_full/minimalInsulinMX1/030/testcrystal_0014_master.h5
ENV POETRY_VERSION=1.8.3

# Install OS packages
Expand All @@ -12,7 +11,7 @@ RUN useradd -ms /bin/bash asuser
WORKDIR /home/asuser/

# Setup Poetry environment
COPY pyproject.toml poetry.lock /home/asuser/
COPY pyproject.toml poetry.lock README.md /home/asuser/
RUN pip install "poetry==$POETRY_VERSION"
RUN poetry config virtualenvs.create false
RUN poetry install
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ Follow these steps to run the simulated SIMPLON API and ensure its proper functi
```
For other operating systems, Install the equivalent libraries for `gcc` and `libhdf5-serial-dev`.

2. **Set the HDF5 File Path**
2. **(Optional) Set the HDF5 File Path**

Before running the API, set the `AS_HDF5_MASTER_FILE` environment variable using the following command:
The master file used by simplon API can be specified via the `AS_HDF5_MASTER_FILE` environment variable:
```bash
export HDF5_MASTER_FILE=/path/to/HDF5_master_file
```
If ``AS_HDF5_MASTER_FILE`` is not specified, the default master file included in this repo is used (`example_1_master.h5`)

Additionally, the master file can also be set dynamically during runtime using the ANSTO endpoints:
`/ansto_endpoints/hdf5_master_file` (see the swagger documentation for more information)

3. **Run the FAST-API application**
```bash
Expand Down Expand Up @@ -68,4 +72,4 @@ After running this script, you should see messages being received by the `receiv
[Stream V2]: https://github.com/dectris/documentation/tree/main/stream_v2

## Documentation
You can see the endpoints currently implemented by accessing the interactive API documentation at [http://localhost:8000/docs](http://localhost:8000/docs). Ensure that the simulated SIMPLON API is up and running to access the documentation.
You can see the endpoints currently implemented by accessing the interactive API documentation at [http://localhost:8000/swagger](http://localhost:8000/swagger). Ensure that the simulated SIMPLON API is up and running to access the documentation.
3 changes: 3 additions & 0 deletions ansto_simplon_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class ZMQStreamSettings(BaseSettings):
GetPydanticSchema(lambda _, _h: _h.generate_schema(FilePath)),
] = Field(
title="HDF5 Master File",
default=os_realpath(
os_joinpath(CUR_DIR, "master_file_examples", "example_1_master.h5")
),
)
DELAY_BETWEEN_FRAMES: float = Field(
title="Delay Between Frames",
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ services:
- "AS_ZMQ_ADDRESS=tcp://*:5555"
#To access the masterfile, you can either copy it to the container by modifying
# the dockerfile, or you can mount a volume containing the masterfile.
- "AS_HDF5_MASTER_FILE=/path/to/HDF5_master_file"
# If the AS_HDF5_MASTER_FILE is not specified, the default mastef file included
# in this repos is used (example_1_master.h5)
#- "AS_HDF5_MASTER_FILE=/path/to/HDF5_master_file"
- "AS_DELAY_BETWEEN_FRAMES=0.0" # seconds
- "AS_NUMBER_OF_DATA_FILES=1" # 2 seems to be the maximum number of files we can load into memory (16M data)
- "AS_NUMBER_OF_FRAMES_PER_TRIGGER=30"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ansto-simplon-api"
version = "0.3.0"
version = "0.3.1"
description = "Simulated simplon api"
authors = [
"Francisco Hernandez Vivanco <hernandf@ansto.gov.au>",
Expand Down

0 comments on commit 45168b5

Please sign in to comment.