Clone tiled from tiled#999 PR branch and pip install -e ".[all]".
Start Tiled server with Redis cache:
tiled serve catalog --temp --api-key secret --redis-uri redis://localhost:6379
Start consumer:
Clone tiled from tiled#999 PR branch and pip install -e ".[all]".
Start Tiled server with Redis cache:
tiled serve catalog --temp --api-key secret --redis-uri redis://localhost:6379
Start consumer:
| import collections | |
| from tiled.mimetypes import DEFAULT_ADAPTERS_BY_MIMETYPE | |
| def build_adapter(data_source, adapters_by_mimetype=None): | |
| # We use a dictionary mapping a mimetype to a callable that returns an Adapter instance. | |
| # This might be a class, classmethod constructor, factory function... | |
| # it does not matter here; it is just a callable. | |
TiledWriter callback extracts information from documents and makes HTTP calls to Tiled, storing the locations and relative alignment of the files.h5py.ExternalLinks into the raw files.At this time we are using Tiled only as a directory service, but of course it could also be used access sliced and transcoded data over HTTP or stream the whole raw files over HTTP.
| import json | |
| from pathlib import Path | |
| from bluesky.callbacks.tiled_writer import TiledWriter | |
| from tiled.client import from_uri | |
| documents = json.loads(Path("documents.json").read_text()) | |
| client = from_uri("http://localhost:8000", api_key="secret") | |
| tw = TiledWriter(client) |
| import dask | |
| import dask.array as da | |
| import distributed | |
| from distributed.protocol.serialize import dask_deserialize, dask_serialize | |
| from dask.distributed import Client | |
| import h5py | |
| import numpy as np | |
| import logging | |
| logger = logging.Logger(__name__) |
| from ophyd.sim import Signal | |
| from ophyd import Component, Device | |
| class Filters(Device): | |
| a = Component(Signal, value=0) | |
| b = Component(Signal, value=1) | |
| def set(self, a, b): | |
| return ( |
python middlware.py.http :8000/data. This should return the list of numbers from the server.print to print a message in the server logs before and after a request is seen.Question: Do the middlewares get run in the order that they are added in middlware.py or in the reverse order?
Install podman. https://podman.io/getting-started/installation
Install podman-compose:
pip install podman-composeClone or copy docker-compose.yml and config.yml from this gist into a directory.
conda activate sandbox
pip install --pre tiled[all] databroker[all] ipython
Note for Mac: Mac uses zsh by default and it requires single quotes like 'databroker[all]'. On the other hand, Windows requires that you not have quotes.
mkdir sandbox
cd sandbox/