-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8babff3
commit b435f52
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM python:3.10 | ||
|
||
RUN mkdir /root/src -p | ||
WORKDIR /root/src | ||
RUN git clone https://github.com/NSLS-II-PDF/pdf-agents.git | ||
|
||
RUN pip3 install --upgrade pip setuptools | ||
RUN pip3 install scikit-learn bluesky-adaptive uvicorn fastapi | ||
RUN pip3 install caproto ophyd | ||
RUN pip3 install git+https://github.com/bluesky/[email protected]#egg=databroker | ||
RUN pip3 install nslsii | ||
RUN pip3 install -e pdf-agents | ||
|
||
COPY ./startup_script.py /root/src/startup_script.py | ||
|
||
ENV BS_AGENT_STARTUP_SCRIPT_PATH=/root/src/startup_script.py | ||
CMD uvicorn bluesky_adaptive.server:app --host 0.0.0.0 --port 60610 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from bluesky_adaptive.server import register_variable, shutdown_decorator, startup_decorator | ||
|
||
from pdf_agents.sklearn import PassiveKmeansAgent | ||
|
||
|
||
class ContainerKmeansAgent(PassiveKmeansAgent): | ||
@property | ||
def name(self): | ||
return "ContainerKmeansAgent" | ||
|
||
|
||
agent = ContainerKmeansAgent(k_clusters=3, report_on_tell=False) | ||
|
||
|
||
@startup_decorator | ||
def startup(): | ||
agent.start() | ||
|
||
|
||
@shutdown_decorator | ||
def shutdown_agent(): | ||
return agent.stop() | ||
|
||
|
||
register_variable("Known UUIDs", agent, "tell_cache") | ||
register_variable("Agent Name", agent, "instance_name") |