Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies = [
"requests",
"scanspec",
"deepdiff",
"heliotrapi >= v0.3.3",
"heliotrapi >= v0.4.1",
"ophyd-async[ca,pva] >=0.21.2",
"bluesky >= 1.16.0",
"daq-config-server >= 1.5.3",
Expand Down
15 changes: 13 additions & 2 deletions src/crystallography_bluesky/i15_1/callbacks/analysis_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@
class TriggerAnalysisCallback(CallbackBase):
"""A callback that will pass the nexus file location to analysis on a plan end."""

def __init__(self, analysis_url: str, analysis_name: str, **kwargs: Any):
def __init__(
self,
analysis_url: str,
analysis_name: str,
username: str | None = None,
password: str | None = None,
Comment on lines +19 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could: What is the usecase for not providing a username/password? Are there some endpoints that don't need it? Or some test tiled instances that don't need it?

@RJCD-Diamond RJCD-Diamond Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heliotrapi can be confgured to not have auth, so username and password are set to None, it's str | None to match that. There are also some endpoints which don't

However for i15-1, it should always have a password so we could always check if None and raise?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I guess if we get round to running system tests for this we would probably set something up w/o using auth so this might be useful. I'm guessing if we pass in None we'll get a 400 error anyway so should be relatively obvious what's gone wrong without having to explicitly check here. Let's leave it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it will return an unauthorised error

**kwargs: Any,
):
"""Create a callback to trigger analysis on plan end.

Args:
analysis_url (str): The url where the analysis listener is running.
analysis_name (str): The name of the analysis to trigger.
username (str or None): The username for heliotrapi
password (str or None): The password for heliotrapi
**kwargs: Additional kwargs passed on to the analysis
"""
self._client = AnalysisClient(analysis_url)
self._client = AnalysisClient(
base_url=analysis_url, username=username, password=password
)
self._analysis_name = analysis_name
self._kwargs = kwargs
self.request_id = None
Expand Down
3 changes: 3 additions & 0 deletions src/crystallography_bluesky/i15_1/plans/centre_sample.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any

import bluesky.plan_stubs as bps
Expand Down Expand Up @@ -57,6 +58,8 @@ def centre_sample(
I15_1_ANALYSIS_URL,
"sample_alignment_i15_1",
beamline="i15-1",
username=os.getenv("HELIOTRAPI_USERNAME"),
password=os.getenv("HELIOTRAPI_PASSWORD"),
)

yield from bps.mv(
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading