Skip to content

Commit 89581af

Browse files
authored
Merge pull request #22 from FelixNgFender/refactor-comments
Refactor comments
2 parents 325f790 + 464322f commit 89581af

File tree

70 files changed

+5990
-1620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5990
-1620
lines changed

python/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,7 @@ pyrightconfig.json
181181

182182
# data files
183183
*.rrd
184+
185+
# benchmark artifacts
186+
benchmarks/payload
187+
benchmarks/results

python/Dockerfile

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# TODO: remove
2+
# FROm python:3.12-slim-bookworm
3+
#
4+
# WORKDIR /app
5+
# COPY python_grpc_bench /app
6+
# COPY proto /app/proto
7+
#
8+
# RUN python -m pip install grpcio grpcio-tools
9+
# RUN python -m grpc_tools.protoc -I/app/proto/helloworld --python_out=. --grpc_python_out=. helloworld.proto
10+
#
11+
# ENTRYPOINT [ "python", "/app/server.py" ]
12+
13+
# FROM python:3.12-alpine AS base
14+
FROM python:3.12-slim-bookworm AS base
15+
16+
ENV VIRTUAL_ENV=/app/.venv \
17+
PATH="/app/.venv/bin:$PATH"
18+
19+
# RUN apk update && \
20+
# apk add libpq
21+
22+
23+
FROM base AS builder
24+
25+
ENV POETRY_NO_INTERACTION=1 \
26+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
27+
POETRY_VIRTUALENVS_CREATE=1 \
28+
POETRY_CACHE_DIR=/tmp/poetry_cache
29+
30+
# RUN apk update && \
31+
# apk add musl-dev build-base gcc gfortran openblas-dev
32+
33+
WORKDIR /app
34+
35+
RUN pip install --no-cache-dir poetry==1.8.4
36+
37+
COPY pyproject.toml poetry.lock ./
38+
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR;
39+
40+
41+
FROM base AS runtime
42+
43+
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
44+
45+
46+
WORKDIR /app
47+
48+
COPY arflow ./arflow
49+
COPY cakelab ./cakelab
50+
51+
EXPOSE 8500
52+
53+
ENV PORT=8500
54+
55+
# TODO: Vary entrypoint to include save mode
56+
ENTRYPOINT ["python", "-m", "arflow._cli", "view"]

python/arflow/__init__.py

+20
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@
77
SessionStream as SessionStream,
88
)
99
from cakelab.arflow_grpc.v1.ar_frame_pb2 import ARFrame as ARFrame
10+
from cakelab.arflow_grpc.v1.audio_frame_pb2 import AudioFrame as AudioFrame
11+
from cakelab.arflow_grpc.v1.color_frame_pb2 import ColorFrame as ColorFrame
12+
from cakelab.arflow_grpc.v1.depth_frame_pb2 import DepthFrame as DepthFrame
1013
from cakelab.arflow_grpc.v1.device_pb2 import Device as Device
14+
from cakelab.arflow_grpc.v1.gyroscope_frame_pb2 import GyroscopeFrame as GyroscopeFrame
15+
from cakelab.arflow_grpc.v1.mesh_detection_frame_pb2 import (
16+
MeshDetectionFrame as MeshDetectionFrame,
17+
)
18+
from cakelab.arflow_grpc.v1.plane_detection_frame_pb2 import (
19+
PlaneDetectionFrame as PlaneDetectionFrame,
20+
)
21+
from cakelab.arflow_grpc.v1.point_cloud_detection_frame_pb2 import (
22+
PointCloudDetectionFrame as PointCloudDetectionFrame,
23+
)
1124
from cakelab.arflow_grpc.v1.session_pb2 import Session as Session
1225
from cakelab.arflow_grpc.v1.transform_frame_pb2 import TransformFrame as TransformFrame
1326

@@ -19,6 +32,13 @@
1932
"ARFlowServicer",
2033
"ARFrame",
2134
"TransformFrame",
35+
"ColorFrame",
36+
"DepthFrame",
37+
"GyroscopeFrame",
38+
"AudioFrame",
39+
"PlaneDetectionFrame",
40+
"PointCloudDetectionFrame",
41+
"MeshDetectionFrame",
2242
"SessionStream",
2343
"Session",
2444
"Device",

python/arflow/_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def parse_args(
100100
"-p",
101101
"--port",
102102
type=int,
103-
default=8500,
103+
default=int(os.getenv("PORT", 8500)),
104104
help=f"Port to run the server on (default: %(default)s).",
105105
)
106106
view_parser.add_argument(

0 commit comments

Comments
 (0)