Skip to content

Commit

Permalink
fix: changes to nginx and compose and publishing agents
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Maffettone committed Apr 10, 2024
1 parent e6ad001 commit 42211ca
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
18 changes: 16 additions & 2 deletions containers/mmm5-tax-day-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,35 @@ services:
build:
context: ../gsas
dockerfile: Containerfile-conda
command: /bin/bash -c "export BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/gsas.py && exec conda run -n GSASII --no-capture-output uvicorn bluesky_adaptive.server:app"
command: conda run -n GSASII --no-capture-output uvicorn bluesky_adaptive.server:app --host 0.0.0.0
environment:
- TILED_API_KEY=$TILED_API_KEY
- BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/gsas.py
volumes:
- type: bind
source: ../pdf_agents
target: /src/pdf-agents/pdf_agents
read_only: true
- type: bind
source: /etc/bluesky/kafka.yml
target: /etc/bluesky/kafka.yml
read_only: true

kmeans-gsas:
image: bluesky:latest
command: /bin/bash -c "BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/kmeans-gsas.py uvicorn bluesky_adaptive.server:app"
command: uvicorn bluesky_adaptive.server:app --host 0.0.0.0
environment:
- TILED_API_KEY=$TILED_API_KEY
- BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/gsas.py
volumes:
- type: bind
source: ../pdf_agents
target: /src/pdf-agents/pdf_agents
read_only: true
- type: bind
source: /etc/bluesky/kafka.yml
target: /etc/bluesky/kafka.yml
read_only: true
depends_on:
gsas:
condition: service_started
Expand Down
20 changes: 15 additions & 5 deletions containers/nginx/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,26 @@

<body>
<div class="container">
<h1>Welcome!</h1>
<p>This is the default landing page for our service. Please check back soon for updates.</p>
<h1>Landing Page for Agent Services!</h1>
<p>This is the default landing page for the agent services.</p>

<!-- Links to your services -->
<h2>Our Services</h2>
<h2>Available Agents</h2>
<ul>
<!-- Link to the GSAS service -->
<li><a href="/gsas/">GSAS Service</a></li>
<li><a href="/gsas/docs">GSAS Service (FastAPI)</a></li>
<!-- Link to the KMeans-GSAS service -->
<li><a href="/kmeans-gsas/">KMeans-GSAS Service</a></li>
<li><a href="/kmeans-gsas/docs">KMeans-GSAS (FastAPI)</a></li>
<!-- Add more services here -->
<!-- Example: <li><a href="/your-service/">Your Service Name</a></li> -->
</ul>

<h2>Available Agent User Interfaces</h2>
<ul>
<!-- Link to the GSAS service -->
<li><a href="/gsas/ui/">GSAS UI</a></li>
<!-- Link to the KMeans-GSAS service -->
<li><a href="/kmeans-gsas/ui/">KMeans-GSAS UI</a></li>
<!-- Add more services here -->
<!-- Example: <li><a href="/your-service/">Your Service Name</a></li> -->
</ul>
Expand Down
5 changes: 2 additions & 3 deletions pdf_agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,12 @@ def generate_report(self, **kwargs):
self.close_and_restart(clear_tell_cache=False, retell_all=False, reason="Per-Run Subscribers")

@classmethod
def get_beamline_objects(cls) -> dict:
ret = super().get_beamline_objects()
def get_default_producer(cls) -> Publisher:
beamline_tla = "pdf"
kafka_config = nslsii.kafka_utils._read_bluesky_kafka_config_file(
config_file_path="/etc/bluesky/kafka.yml"
)
ret["report_producer"] = Publisher(
ret = Publisher(
topic=f"{beamline_tla}.mmm.bluesky.agents",
bootstrap_servers=",".join(kafka_config["bootstrap_servers"]),
key="{beamline_tla}.key",
Expand Down
5 changes: 5 additions & 0 deletions pdf_agents/startup_scripts/mmm5-tax-day/gsas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@
}
}

report_producer = RefinementAgent.get_default_producer()


agent = RefinementAgent(
# GSAS Args
cif_paths=["/src/pdf-agents/assets/fcc.cif"],
refinement_params=[param_dict_phase1],
inst_param_path="/src/pdf-agents/assets/LaB6_IPF.instprm",
# Required report producer
report_producer=report_producer,
# BS Adaptive Args
ask_on_tell=False,
report_on_tell=True,
Expand Down

0 comments on commit 42211ca

Please sign in to comment.