Skip to content

Commit 0727bcf

Browse files
authored
Upgrade to deephaven 0.17.0 (#101)
* Upgrade to deephaven 0.17.0 * Locked the ib api version. * Build ib whls. * Use CI built IB wheels in docker builds. * Debugging IB wheel generation * Debugging IB wheel generation * Use IB wheels for sphinx. * Fix IB wheel artificat publication. * Buid AMD64 and ARM64 docker images. * upgrade docker publish task. * Buid AMD64 and ARM64 docker images. * Use IB wheels for sphinx. * Store sphinx hotspots. * Cleaned up launch options and related documentation. * Don't start sphinx server.
1 parent e01010c commit 0727bcf

File tree

15 files changed

+146
-236
lines changed

15 files changed

+146
-236
lines changed

.github/workflows/Dockerfile.pip

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11

22
FROM ubuntu:22.04
33

4-
ARG IB_VERSION
5-
64
RUN apt update && \
7-
apt install -y openjdk-11-jdk python3-pip curl zip && \
5+
apt install -y openjdk-11-jdk python3-pip python3-venv curl zip && \
86
pip3 install --upgrade pip setuptools wheel
97

108
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
119

12-
RUN mkdir /build && \
13-
cd /build && \
14-
curl -o ./api.zip "https://interactivebrokers.github.io/downloads/twsapi_macunix.${IB_VERSION}.zip" && \
15-
unzip api.zip && \
16-
cd ./IBJts/source/pythonclient && \
17-
python3 setup.py install && \
18-
cd / && \
19-
rm -rf /build
20-
2110
COPY ./wheels /wheels
11+
COPY ./ib-wheels /ib-wheels
2212

23-
RUN pip3 install /wheels/*.whl && \
24-
rm -rf /wheels/
13+
RUN pip3 install /ib-wheels/*.whl && \
14+
pip3 install /wheels/*.whl && \
15+
rm -rf /ib-wheels/ /wheels/
2516

2617
CMD python3

.github/workflows/Dockerfile.server

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@ ARG DH_VERSION
22

33
FROM ghcr.io/deephaven/server:${DH_VERSION}
44

5-
ARG IB_VERSION
6-
75
RUN apt update && \
86
apt install -y python3-pip python3-venv curl zip && \
97
pip3 install --upgrade pip setuptools wheel
108

11-
RUN mkdir /build && \
12-
cd /build && \
13-
curl -o ./api.zip "https://interactivebrokers.github.io/downloads/twsapi_macunix.${IB_VERSION}.zip" && \
14-
unzip api.zip && \
15-
cd ./IBJts/source/pythonclient && \
16-
python3 setup.py install && \
17-
cd / && \
18-
rm -rf /build
19-
209
COPY ./wheels /wheels
10+
COPY ./ib-wheels /ib-wheels
2111

22-
RUN pip3 install /wheels/*.whl && \
23-
rm -rf /wheels/
12+
RUN pip3 install /ib-wheels/*.whl && \
13+
pip3 install /wheels/*.whl && \
14+
rm -rf /ib-wheels/ /wheels/

.github/workflows/build-and-publish.yml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,35 @@ on:
1313

1414
env:
1515
IB_VERSION: 1016.01
16-
DH_VERSION: 0.16.0
16+
DH_VERSION: 0.17.0
1717

1818
jobs:
19+
build-ib-whl:
20+
name: Build IB WHL
21+
runs-on: ubuntu-20.04
22+
steps:
23+
- name: Setup Python
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: 3.7
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install --upgrade setuptools wheel build twine
31+
- name: Build
32+
run: |
33+
curl -o ./api.zip "https://interactivebrokers.github.io/downloads/twsapi_macunix.${IB_VERSION}.zip"
34+
unzip api.zip
35+
cd ./IBJts/source/pythonclient
36+
python -m build
37+
- name: Archive build artifacts
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: ib-wheels
41+
path: |
42+
./IBJts/source/pythonclient/dist/*
43+
44+
1945
build-whl:
2046
name: Build WHL
2147
runs-on: ubuntu-20.04
@@ -74,7 +100,7 @@ jobs:
74100
build-sphinx:
75101
name: Build Sphinx
76102
runs-on: ubuntu-20.04
77-
needs: [build-whl]
103+
needs: [build-ib-whl, build-whl]
78104
steps:
79105
- uses: actions/checkout@v1
80106
- name: Apt installs
@@ -83,6 +109,12 @@ jobs:
83109
sudo apt install -y openjdk-11-jdk
84110
- name: Pip installs
85111
run: pip3 install --upgrade sphinx==4.2.0 sphinx-autodoc-typehints furo==2021.10.9
112+
- name: Download IB wheels
113+
uses: actions/download-artifact@v3
114+
with:
115+
name: ib-wheels
116+
- name: Install IB Whl
117+
run: pip3 install *.whl
86118
- name: Download wheels
87119
uses: actions/download-artifact@v3
88120
with:
@@ -109,6 +141,7 @@ jobs:
109141
path: '**/*_pid*.log'
110142
if-no-files-found: ignore
111143

144+
112145
publish-sphinx:
113146
name: Publish Sphinx
114147
runs-on: ubuntu-20.04
@@ -126,11 +159,19 @@ jobs:
126159
with:
127160
branch: gh-pages
128161
folder: html/
162+
- name: Upload JVM Error Logs
163+
uses: actions/upload-artifact@v3
164+
if: failure()
165+
with:
166+
name: sphinx-jvm-err
167+
path: '**/*_pid*.log'
168+
if-no-files-found: ignore
169+
129170

130171
docker-pip:
131172
name: Build and Publish Docker (pip-installed Deephaven)
132173
runs-on: ubuntu-20.04
133-
needs: [build-whl]
174+
needs: [build-ib-whl, build-whl]
134175
permissions:
135176
contents: read
136177
packages: write
@@ -140,6 +181,11 @@ jobs:
140181
- name: Get branch name
141182
id: branch-name
142183
uses: tj-actions/[email protected]
184+
- name: Download IB wheels
185+
uses: actions/download-artifact@v3
186+
with:
187+
name: ib-wheels
188+
path: ib-wheels/
143189
- name: Download wheels
144190
uses: actions/download-artifact@v3
145191
with:
@@ -162,10 +208,15 @@ jobs:
162208
type=ref,event=tag
163209
type=ref,event=pr
164210
type=raw,${{ steps.branch-name.outputs.current_branch }}
211+
- name: Set up QEMU
212+
uses: docker/setup-qemu-action@v2
213+
- name: Set up Docker Buildx
214+
uses: docker/setup-buildx-action@v2
165215
- name: Build and push Docker image
166-
uses: docker/build-push-action@v2.7.0
216+
uses: docker/build-push-action@v3
167217
with:
168218
context: .
219+
platforms: linux/amd64,linux/arm64
169220
file: ./.github/workflows/Dockerfile.pip
170221
push: true
171222
tags: ${{ steps.meta-base.outputs.tags }}
@@ -174,10 +225,11 @@ jobs:
174225
env:
175226
IMAGE_NAME: ${{ github.repository }}
176227

228+
177229
docker-dhserver:
178230
name: Build and Publish Docker (Deephaven server image)
179231
runs-on: ubuntu-20.04
180-
needs: [build-whl]
232+
needs: [build-ib-whl, build-whl]
181233
permissions:
182234
contents: read
183235
packages: write
@@ -187,6 +239,11 @@ jobs:
187239
- name: Get branch name
188240
id: branch-name
189241
uses: tj-actions/[email protected]
242+
- name: Download IB wheels
243+
uses: actions/download-artifact@v3
244+
with:
245+
name: ib-wheels
246+
path: ib-wheels/
190247
- name: Download wheels
191248
uses: actions/download-artifact@v3
192249
with:
@@ -210,10 +267,15 @@ jobs:
210267
type=ref,event=tag
211268
type=ref,event=pr
212269
type=raw,${{ steps.branch-name.outputs.current_branch }}
270+
- name: Set up QEMU
271+
uses: docker/setup-qemu-action@v2
272+
- name: Set up Docker Buildx
273+
uses: docker/setup-buildx-action@v2
213274
- name: Build and push Docker image
214-
uses: docker/build-push-action@v2.7.0
275+
uses: docker/build-push-action@v3
215276
with:
216277
context: .
278+
platforms: linux/amd64,linux/arm64
217279
file: ./.github/workflows/Dockerfile.server
218280
push: true
219281
tags: ${{ steps.meta-base.outputs.tags }}

README.md

Lines changed: 24 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -171,42 +171,10 @@ upper right corner. ![](https://raw.githubusercontent.com/deephaven-examples/de
171171
There are multiple ways to launch [Deephaven](https://deephaven.io) with [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib)
172172
installed. The launch can either happen via a local installation or via Docker images.
173173

174-
Lightweight installations use pip-installed Deephaven. These systems have less overhead, but they lack
175-
a few Deephaven IDE features. Heavyweight installations launch the entire [Deephaven](https://deephaven.io) system.
176-
These systems launch multiple Docker containers and have more overhead, but they provide all Deephaven IDE features.
174+
For a Docker Compose example, see [docker/release/](docker/release/).
177175

178-
If you are running scripts that do not need human interaction, consider using a pip-installed option.
179-
If you are interactively working with data, consider the full deephaven system.
180176

181-
### (Option 1) Launch the full Deephaven system -- interactive
182-
183-
> **_NOTE:_** Deephaven does not yet have published Docker images for all architectures. This launch should work on Linux (AMD64 and ARM64), Mac (Intel), and Windows WSL. It is not yet supported on Windows without WSL or Mac (M1 and M2). In these cases, the `full_web_1` Docker image will exit. This can be seen using `docker ps` or `docker compose ps`. For these architectures, you will need to build Deephaven Docker images locally. See [Build and launch from source](https://deephaven.io/core/docs/how-to-guides/launch-build/).
184-
185-
186-
The full Deephaven system contains the most full-featured IDE. Running the full Deephaven system launches multiple Docker
187-
containers, so it has the most overhead. This is a good option for interactively working with data.
188-
189-
See [./docker/full](./docker/full) for more details.
190-
191-
1) Clone the deephaven-ib repository:
192-
* On Mac:
193-
```bash
194-
git clone [email protected]:deephaven-examples/deephaven-ib.git
195-
cd ./docker/full/
196-
```
197-
2) Create a directory for your data and scripts
198-
```bash
199-
mkdir data
200-
cp <your_data_and_scripts> data
201-
```
202-
3) Launch the system:
203-
```bash
204-
./run_system.sh
205-
```
206-
4) Launch the [Deephaven IDE](https://github.com/deephaven/deephaven-core/blob/main/README.md#run-deephaven-ide) by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in a browser.
207-
208-
209-
### (Option 2) Launch pip-installed Deephaven with Docker -- interactive
177+
### (Option 1) Launch pip-installed Deephaven with Docker -- interactive
210178

211179
The pip-installed Deephaven uses a lightweight Deephaven installation that is installed using pip. In this case,
212180
the pip-installed Deephaven system is installed in a Docker container.
@@ -215,23 +183,19 @@ the pip-installed Deephaven system is installed in a Docker container.
215183
```bash
216184
mkdir data
217185
```
218-
2) Launch the system:
219-
* On Mac:
220-
```bash
221-
git clone [email protected]:deephaven-examples/deephaven-ib.git
222-
./deephaven-ib/docker/dev/build.sh
223-
# Set jvm_args to the desired JVM memory for Deephaven
224-
docker run -it -v data:/data -p 10000:10000 deephaven-examples/deephaven-ib:dev python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
225-
```
226-
* On other platforms:
186+
2) Create a directory for your Deephaven IDE configuration and notebooks
187+
```bash
188+
mkdir `pwd`/.deephaven
189+
```
190+
3) Launch the system:
227191
```bash
228192
# Set jvm_args to the desired JVM memory for Deephaven
229-
docker run -it -v data:/data -p 10000:10000 ghcr.io/deephaven-examples/deephaven-ib python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
193+
docker run -it -v data:/data -v `pwd`/.deephaven:/storage -p 10000:10000 ghcr.io/deephaven-examples/deephaven-ib python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
230194
```
231-
3) Launch the [Deephaven IDE](https://github.com/deephaven/deephaven-core/blob/main/README.md#run-deephaven-ide) by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in a browser.
195+
4) Launch the [Deephaven IDE](https://github.com/deephaven/deephaven-core/blob/main/README.md#run-deephaven-ide) by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in a browser.
232196

233197

234-
### (Option 3) Launch pip-installed Deephaven with Docker -- run a script
198+
### (Option 2) Launch pip-installed Deephaven with Docker -- run a script
235199

236200
The pip-installed Deephaven uses a lightweight Deephaven installation that is installed using pip. In this case,
237201
the pip-installed Deephaven system is installed in a Docker container.
@@ -244,23 +208,19 @@ This is a good option for production scenarios where scripts need to be run and
244208
# Set jvm_args to the desired JVM memory for Deephaven
245209
cp path/to/your_script.py data/your_script.py
246210
```
247-
2) Launch the system and execute a custom script:
248-
* On Mac:
249-
```bash
250-
git clone [email protected]:deephaven-examples/deephaven-ib.git
251-
./deephaven-ib/docker/dev/build.sh
252-
docker run -it -v data:/data -p 10000:10000 deephaven-examples/deephaven-ib:dev python3 -i /data/your_script.py
253-
```
254-
* On other platforms:
211+
2) Create a directory for your Deephaven IDE configuration and notebooks
212+
```bash
213+
mkdir `pwd`/.deephaven
214+
```
215+
3) Launch the system:
255216
```bash
256-
docker run -it -v data:/data -p 10000:10000 ghcr.io/deephaven-examples/deephaven-ib python3 -i /data/your_script.py
217+
# Set jvm_args to the desired JVM memory for Deephaven
218+
docker run -it -v data:/data -v `pwd`/.deephaven:/storage -p 10000:10000 ghcr.io/deephaven-examples/deephaven-ib python3 -i /data/your_script.py
257219
```
258-
3) Launch the [Deephaven IDE](https://github.com/deephaven/deephaven-core/blob/main/README.md#run-deephaven-ide) by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in a browser.
259-
220+
4) Launch the [Deephaven IDE](https://github.com/deephaven/deephaven-core/blob/main/README.md#run-deephaven-ide) by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in a browser.
260221

261-
### (Option 4) Launch pip-installed Deephaven with a local installation (No Docker) -- interactive
262222

263-
> **_NOTE:_** Deephaven pip install is not yet supported on all architectures. This launch should work on Linux (AMD64 and ARM64), Mac (M1 and Intel), and Windows WSL. It is not yet supported on Windows without WSL. For Windows, use WSL.
223+
### (Option 3) Launch pip-installed Deephaven with a local installation (No Docker) -- interactive
264224

265225
The pip-installed Deephaven uses a lightweight Deephaven installation that is installed using pip. In this case,
266226
the pip-installed Deephaven system is installed directly on your local system, without Docker.
@@ -285,14 +245,13 @@ new feature and has not been well tested. To do this:
285245
4) Launch the system:
286246
```bash
287247
# Set jvm_args to the desired JVM memory for Deephaven
288-
python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
248+
# Deephaven IDE configuration and notebooks are stored to ~/.deephaven
249+
python3 -i -c "import os; from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g','-Dstorage.path=' + os.path.expanduser('~/.deephaven')]); _server.start()"
289250
```
290251
5) Launch the [Deephaven IDE](https://github.com/deephaven/deephaven-core/blob/main/README.md#run-deephaven-ide) by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in a browser.
291252
6) Use `host="localhost"` for the hostname in the examples (Windows WSL uses `host="host.docker.internal"`, since WSL is built on Docker.)
292253

293-
### (Option 5) Launch pip-installed Deephaven with a local installation (No Docker) -- run a script
294-
295-
> **_NOTE:_** Deephaven pip install is not yet supported on all architectures. This launch should work on Linux (AMD64 and ARM64), Mac (M1 and Intel), and Windows WSL. It is not yet supported on Windows without WSL. For Windows, use WSL.
254+
### (Option 4) Launch pip-installed Deephaven with a local installation (No Docker) -- run a script
296255

297256
The pip-installed Deephaven uses a lightweight Deephaven installation that is installed using pip. In this case,
298257
the pip-installed Deephaven system is installed directly on your local system, without Docker.
@@ -317,7 +276,8 @@ new feature and has not been well tested. To do this:
317276
```
318277
4) Launch the system and execute a custom script:
319278
```bash
320-
# your_script.py must begin with: "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
279+
# your_script.py must begin with: "import os; from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g','-Dstorage.path=' + os.path.expanduser('~/.deephaven')]); _server.start()"
280+
# Deephaven IDE configuration and notebooks are stored to ~/.deephaven
321281
# Set jvm_args to the desired JVM memory for Deephaven
322282
python3 -i your_script.py
323283
```

docker/dev/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This directory contains the ingredients to build Docker images from the current,
44

55
This is useful when doing local development or when official images are not available for your platform.
66

7+
In general, you will want to use the officially released images at [https://github.com/deephaven-examples/deephaven-ib/pkgs/container/deephaven-ib](https://github.com/deephaven-examples/deephaven-ib/pkgs/container/deephaven-ib).
8+
79
## Build Image
810

911
```bash
@@ -12,8 +14,14 @@ This is useful when doing local development or when official images are not avai
1214

1315
## Run image in interactive mode
1416

17+
```bash
18+
docker compose up
19+
```
20+
21+
or
22+
1523
```bash
1624
# Set jvm_args to the desired JVM memory for Deephaven
17-
docker run -it -v data:/data -p 10000:10000 deephaven-examples/deephaven-ib:dev python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
25+
docker run -it -v data:/data -v `pwd`/.deephaven:/storage -p 10000:10000 deephaven-examples/deephaven-ib:dev python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
1826
```
1927

docker/dev/docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.4"
2+
3+
services:
4+
server:
5+
image: deephaven-examples/deephaven-ib:dev
6+
command: python3 -i -c "from deephaven_server import Server; _server = Server(port=10000, jvm_args=['-Xmx4g']); _server.start()"
7+
stdin_open: true
8+
tty: true
9+
ports:
10+
- "${DEEPHAVEN_PORT:-10000}:10000"
11+
volumes:
12+
- ./data:/data
13+
- ~/.deephaven:/storage
14+

0 commit comments

Comments
 (0)