Skip to content

Commit 92a8c9a

Browse files
adding example for a simple remote state
1 parent 272e962 commit 92a8c9a

File tree

6 files changed

+1773
-36
lines changed

6 files changed

+1773
-36
lines changed

configs/pymcs-benchmark/base.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,48 @@ resources:
99
- 6383 # GCS server (Ray head node port)
1010
- 8263 # Dashboard port (optional, if --include-dashboard is true)
1111
- 50001 # Ray client server port
12+
- 50002 # Ray client server port
1213

1314
num_nodes: 1
1415
envs:
1516
LLM_DEVICE: NONE # CPU or CUDA
1617

1718
# this will be synced to the node as `~/sky_workdir`
19+
file_mounts:
20+
# Format: <cluster path>: <local path/cloud object URI>
21+
/pymc-server: /tmp/pymc-server
1822
workdir: ./
1923
# The setup command. Will be run under the working directory.
2024
setup: |
2125
set -e # Exit if any command failed.
2226
27+
# storage layer
28+
sudo mkdir /data
29+
sudo chown gcpuser -R /data
30+
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20241002175041.0.0_amd64.deb -O minio.deb
31+
sudo dpkg -i minio.deb
32+
2333
# install pixi and project dependencies
2434
curl -fsSL https://pixi.sh/install.sh | bash
2535
source /home/gcpuser/.bashrc
26-
pixi install --manifest-path pyproject.toml -e server
36+
37+
cp pyproject.toml pyproject.toml.orig
38+
cp pyproject.toml.cloud pyproject.toml
39+
40+
pixi install --manifest-path pyproject.toml -e pymc
2741
2842
2943
# FIXME: check why ray client is not installed from pixi, setup is correct according to https://pixi.sh/latest/reference/project_configuration/#version-specification
3044
pixi run \
31-
--environment server \
45+
--environment pymc \
3246
--manifest-path pyproject.toml \
3347
pip3 install "ray[default,client]==2.37.0"
3448
3549
3650
# start separate ray for pymc-server
3751
# TODO: Launch the head-only command only on the first node in multinode setup
3852
pixi run \
39-
--environment server\
53+
--environment pymc\
4054
--manifest-path pyproject.toml \
4155
ray start \
4256
--head \
@@ -45,6 +59,9 @@ setup: |
4559
--dashboard-host=0.0.0.0 \
4660
--dashboard-port=8263 \
4761
--disable-usage-stats
48-
62+
63+
# this will block
64+
nohup minio server /data --address 0.0.0.0:50002 > minio.log 2>&1 &
65+
minio server /data
4966
5067

examples/traces/produce_trace.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ def run(self):
105105
compiled = nutpie.compile_pymc_model(freeze_dims_and_data(model), backend="numba")
106106

107107
# Sample using nutpie
108-
tr = nutpie.sample(compiled, store_unconstrained=True, store_gradient=True, seed=123)
108+
#tr = nutpie.sample(compiled, store_unconstrained=True, store_gradient=True, seed=123)
109109
_ = tr.to_zarr("/tmp/output.zarr")
110110
self.result = tr
111-
from ray.util import inspect_serializability
112-
self.is_ser = inspect_serializability(tr, name="tr")
111+
# from ray.util import inspect_serializability
112+
# self.is_ser = inspect_serializability(tr, name="tr")
113113

114114
self.done = True
115115

@@ -121,6 +121,8 @@ def run(self):
121121
bar='911'
122122
)
123123

124-
#print(server.run())
124+
server.run()
125+
print(server.result)
126+
server._kill()
125127

126-
breakpoint()
128+
#breakpoint()

examples/traces/s3_minio.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import s3fs
2+
import xarray as xr
3+
import arviz
4+
5+
# Configure the S3 connection (MinIO)
6+
s3 = s3fs.S3FileSystem(
7+
anon=False, # Set to True if your bucket allows anonymous access
8+
key='minioadmin', # Replace with your MinIO access key
9+
secret='minioadmin', # Replace with your MinIO secret key
10+
client_kwargs={'endpoint_url': 'http://34.66.59.65:50002'} # Replace with your MinIO URL
11+
)
12+
13+
# Specify the path to the Zarr dataset in the MinIO bucket
14+
zarr_path = 'upload/out.zarr'
15+
16+
# Open the Zarr dataset with xarray
17+
store = s3fs.S3Map(root=zarr_path, s3=s3)
18+
#ds = xr.open_zarr(store, consolidated=True)
19+
ds = arviz.from_zarr(store)
20+
print(ds)
21+
breakpoint()
22+

0 commit comments

Comments
 (0)