Skip to content

Commit 1128d1f

Browse files
authored
Merge branch 'main' into run_notebooks
2 parents 5f8bea9 + f2cedfd commit 1128d1f

File tree

15 files changed

+123
-95
lines changed

15 files changed

+123
-95
lines changed

.env

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ AWS_SECRET_ACCESS_KEY=minioadmin
33
BUCKET=ngff-latency-benchmark
44
HOST=nginx
55

6-
XY=32768
7-
Z=1
8-
C=32
9-
T=1
10-
XC=256
11-
ZC=1
6+
XY=1024
7+
Z=1024
8+
C=1
9+
T=100
10+
XC=32
11+
ZC=32
12+
ROOT=/var/lib/docker
1213
ROOT=/uod/idr-scratch/ngff-latency-benchmark
14+
ROOT=/uod/idr/scratch/idr1-slot2/ngff-latency-benchmark
15+
ROOT=/home/ubuntu/ngff-latency-benchmark
16+
1317
NAME=${XY}-Z-${Z}-T-${T}-C-${C}-XYC-${XC}-ZC-${ZC}
1418
DIR=${ROOT}/${NAME}
1519
BASE=IMS_XY-${NAME}

.env-gha

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
AWS_ACCESS_KEY_ID=minioadmin
2+
AWS_SECRET_ACCESS_KEY=minioadmin
3+
BUCKET=ngff-latency-benchmark
4+
HOST=nginx
5+
6+
XY=32
7+
Z=1
8+
C=1
9+
T=1
10+
XC=1
11+
ZC=1
12+
ROOT=/tmp
13+
NAME=${XY}-Z-${Z}-T-${T}-C-${C}-XYC-${XC}-ZC-${ZC}
14+
DIR=${ROOT}/${NAME}
15+
BASE=IMS_XY-${NAME}
16+
ROUNDS=20
17+
TEST_REPEATS=1
18+
19+
S3ARGS={"anon": true, "client_kwargs": {"endpoint_url": "http://${HOST}:9000"}}

.github/workflows/main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Build
3+
4+
on:
5+
push:
6+
pull_request:
7+
schedule:
8+
- cron: '0 0 * * 0'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set env
16+
run: |
17+
rm .env
18+
mv .env-gha .env
19+
- name: Build
20+
run: |
21+
docker-compose pull && docker-compose build
22+
- name: Generate
23+
run: ./generate.sh
24+
- name: Start Upload and Run benchmark
25+
run: ./test.sh
26+
- name: Check logs
27+
run: docker-compose logs
28+
if: ${{ failure() }}

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
[![DOI](https://zenodo.org/badge/329595844.svg)](https://zenodo.org/badge/latestdoi/329595844)
12
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ome/ngff-latency-benchmark/master?filepath=notebooks)
23
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ome/ngff-latency-benchmark/)
34

4-
# How to use this repository
5+
# OME-NGFF: latency benchmark
56

67
To get started, clone this repository locally:
78
```
@@ -20,16 +21,6 @@ You will likely want to adjust the parameters in `.env` first, then run:
2021
which will run several docker-compose commands in a row. This could take
2122
a substantial amount of time depending on your parameters.
2223

23-
## Or, alternatively download a sample file
24-
25-
```
26-
mkdir data
27-
cd data
28-
../retina.sh
29-
```
30-
31-
If you choose to use `retina_large`, you will also need to adjust the parameters in `.env`.
32-
3324

3425
## Then, start S3 and upload the data
3526

benchmark/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ FROM continuumio/miniconda3
22
COPY environment.yml /tmp/environment.yml
33
RUN conda update -n base -c defaults conda
44
RUN conda env create -n benchmark -f /tmp/environment.yml
5+
RUN conda list -n benchmark
56

67
# Note: docker-compose.yml mounts this file on each run
78
# to prevent stale copies.
89
COPY benchmark.sh /benchmark/benchmark.sh
910
COPY benchmark.py /benchmark/benchmark.py
10-
COPY plot_results.py /benchmarks/plot_results.py
11+
COPY plot_results.py /benchmark/plot_results.py
1112

12-
# see https://github.com/zarr-developers/zarr-python/pull/699
13-
RUN conda run -n benchmark pip install git+https://github.com/zarr-developers/zarr-python@master#egg=zarr
1413
RUN conda run -n benchmark pip install pytest-profiling
1514
RUN conda run -n benchmark pip install seaborn
1615
RUN conda run -n benchmark pip install pytest-csv

benchmark/benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def run(self, chunk_index):
183183
try:
184184
group = zarr.group(store=store)
185185
data = group["0"]
186-
except KeyError:
186+
except (KeyError, ValueError):
187187
# This likely happens due to dim
188188
data = zarr.open(store, mode="r")
189189
chunks = data.chunks

benchmark/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
- scikit-image
1414
- scipy
1515
- xarray
16-
- zarr >= 2.4.0
16+
- zarr >= 2.7.0
1717
- go-mc
1818
- pip
1919
- pip:

benchmark/plot_results.py

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,26 @@
55
import pandas as pd
66
import seaborn as sns
77

8-
json_path = os.environ.get("BENCHMARK_DATA", "benchmark_data")
8+
data_path = os.environ.get("BENCHMARK_DATA", "benchmark_data")
99
plot_path = os.environ.get("BENCHMARK_PLOT", "benchmark_plot.png")
10-
1110
xy = os.environ.get("XY", "unknown")
1211

13-
# s3+hdf5, s3+tiff, s3+zarr, remote+hdf5, remote+… so I’d color by tiff/hdf5/zarr
14-
15-
print("base_path", json_path)
16-
17-
18-
three_col = []
19-
two_col = []
20-
21-
test_repeats = int(os.getenv("TEST_REPEATS", "1"))
22-
json_files = ["%s_benchmark_data.json" % r for r in range(test_repeats)]
23-
print("json_files", json_files)
24-
25-
for root, dirs, files in os.walk(json_path):
26-
for file_name in files:
27-
if file_name in json_files:
28-
path = os.path.join(root, file_name)
29-
print("json path", path)
30-
with open(path) as json_file:
31-
benchmarks = json.load(json_file)["benchmarks"]
12+
csv = pd.read_csv(f"{data_path}/0_benchmark_data.csv")
3213

33-
for bm in benchmarks:
34-
m = re.match(r"test_(1_byte|\w+)_(\w+)\[(\w+)\]", bm["name"])
35-
if not m:
36-
raise Exception(bm["name"])
37-
typ = m.group(1).replace("1_byte", "overhead")
38-
src = m.group(3)
39-
40-
if typ == "overhead" and src == "local":
41-
# 10e-5 skews the view.
42-
continue
43-
44-
if test_repeats == 1:
45-
# Ran tests once: plot every data point
46-
vals = bm["stats"]["data"]
47-
for run, val in enumerate(vals):
48-
three_col.append(
49-
{"type": typ, "source": src, "seconds": val}
50-
)
51-
two_col.append({"name": f"{typ}-{src}", "seconds": val})
52-
else:
53-
# Repeats: take mean value from each
54-
val = bm["stats"]["mean"]
55-
three_col.append({"type": typ, "source": src, "seconds": val})
56-
two_col.append({"name": f"{typ}-{src}", "seconds": val})
57-
58-
df3 = pd.DataFrame.from_dict(three_col)
59-
df2 = pd.DataFrame.from_dict(two_col)
60-
61-
types = ("overhead", "zarr", "tiff", "hdf5")
14+
types = ("Overhead", "Zarr", "TIFF", "HDF5")
6215
sources = ("local", "http", "s3")
6316
orders = {"type": types, "source": sources}
6417

6518
pal_points = "colorblind"
6619
pal_violins = "pastel"
6720

6821
g = sns.FacetGrid(
69-
df3, col="source", col_order=sources, sharey=False, height=5, aspect=0.6,
22+
csv,
23+
col="source",
24+
col_order=sources,
25+
sharey=False,
26+
height=5,
27+
aspect=0.6,
7028
)
7129

7230
g = g.map(
@@ -83,7 +41,7 @@
8341

8442
g = g.map(
8543
sns.stripplot,
86-
"type",
44+
"type", # was type
8745
"seconds",
8846
dodge=True,
8947
order=types,
@@ -93,7 +51,7 @@
9351
)
9452

9553
g.despine(left=True)
96-
g.set(yscale="log", ylim=(0.0009, 1))
54+
g.set(yscale ='log', ylim=(0.0009, 1))
9755

9856
# Set axis labels & ticks #
9957
for ax in g.fig.get_axes():
@@ -105,7 +63,11 @@
10563
# Remove outline of violins
10664
col.set_edgecolor("white")
10765

66+
# Only show on far left plot
10867
g.fig.get_axes()[0].set_ylabel("Seconds")
10968
g.fig.get_axes()[0].spines["left"].set_visible(True)
11069

70+
# Add annotations
71+
g.fig.get_axes()[0].text(0.0001, 0.001, "off-\nscale")
72+
11173
g.savefig(plot_path, dpi=600)

convert/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN conda install -c ome bioformats2raw raw2ometiff
55
# Temporary
66
#
77
RUN conda install -y -c anaconda -c conda-forge maven git
8-
RUN git clone -b nested --depth=1 git://github.com/joshmoore/bioformats2raw /tmp/bioformats2raw
8+
RUN git clone -b nested-re-re --depth=1 git://github.com/joshmoore/bioformats2raw /tmp/bioformats2raw
99
RUN git clone -b nested --depth=1 git://github.com/joshmoore/raw2ometiff /tmp/raw2ometiff
1010
RUN git clone -b nested --depth=1 git://github.com/joshmoore/jzarr /tmp/jzarr
1111
RUN cd /tmp/jzarr \

docker-compose.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ services:
3232
environment:
3333
- BASE
3434
- DIR
35+
- NAME
3536
- HOST
36-
- MINIO_ACCESS_KEY="${AWS_ACCESS_KEY_ID}"
37-
- MINIO_SECRET_KEY="${AWS_SECRET_ACCESS_KEY}"
37+
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID}
38+
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY}
3839

3940
benchmark:
4041
build: benchmark
@@ -76,8 +77,8 @@ services:
7677
expose:
7778
- "9000"
7879
environment:
79-
- MINIO_ACCESS_KEY="${AWS_ACCESS_KEY_ID}"
80-
- MINIO_SECRET_KEY="${AWS_SECRET_ACCESS_KEY}"
80+
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID}
81+
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY}
8182
command: server http://minio{1...4}/data{1...2}
8283
healthcheck:
8384
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
@@ -93,8 +94,8 @@ services:
9394
expose:
9495
- "9000"
9596
environment:
96-
- MINIO_ACCESS_KEY="${AWS_ACCESS_KEY_ID}"
97-
- MINIO_SECRET_KEY="${AWS_SECRET_ACCESS_KEY}"
97+
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID}
98+
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY}
9899
command: server http://minio{1...4}/data{1...2}
99100
healthcheck:
100101
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
@@ -110,8 +111,8 @@ services:
110111
expose:
111112
- "9000"
112113
environment:
113-
- MINIO_ACCESS_KEY="${AWS_ACCESS_KEY_ID}"
114-
- MINIO_SECRET_KEY="${AWS_SECRET_ACCESS_KEY}"
114+
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID}
115+
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY}
115116
command: server http://minio{1...4}/data{1...2}
116117
healthcheck:
117118
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
@@ -127,8 +128,8 @@ services:
127128
expose:
128129
- "9000"
129130
environment:
130-
- MINIO_ACCESS_KEY="${AWS_ACCESS_KEY_ID}"
131-
- MINIO_SECRET_KEY="${AWS_SECRET_ACCESS_KEY}"
131+
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID}
132+
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY}
132133
command: server http://minio{1...4}/data{1...2}
133134
healthcheck:
134135
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]

0 commit comments

Comments
 (0)