-
Clone this gist and enter the directory.
-
Install Tiled and and, optionally, a HTTP client to test with.
pip install tiled[all] httpie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import metadatastore.conf | |
from collections import deque | |
from tqdm import tqdm | |
import ipyparallel as ipp | |
def main(): | |
old_config = dict(metadatastore.conf.connection_config) | |
new_config = old_config.copy() | |
new_config['database'] = 'metadatastore_production_v1' |
- Run
python middlware.py
. - Using HTTPie, request data:
http :8000/data
. This should return the list of numbers from the server. - Add a simple middleware that just uses
print
to print a message in the server logs before and after a request is seen. - Add a second middleware that also prints.
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-compose
-
Clone or copy
docker-compose.yml
andconfig.yml
from this gist into a directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import ftplib | |
import os | |
import tqdm | |
import time | |
""" | |
Example usage as a CLI: | |
``` |
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/
NewerOlder