Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change logging level on PandASubdirectoryProvider #516

Merged
merged 5 commits into from
May 16, 2024

Conversation

olliesilvester
Copy link
Collaborator

@olliesilvester olliesilvester commented May 9, 2024

In a previous PR I suggested adding this logging message, but later realised it would appear every time Hyperion started, so debug is better

Instructions to reviewer on how to test:

  1. Confirm changes and tests sensible
  2. Run unit tests

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly

@@ -20,7 +24,13 @@ def __init__(self, directory: Path | None = None):
else None
)

def update(self, directory: Path):
def update(self, directory: Path, create_directory=False):
if create_directory:
Copy link
Contributor

Choose a reason for hiding this comment

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

As is, you're allowed to (but always not) pass in a Path on construction, but the path is only created on update. If passing a Path into the initialiser isn't desired, remove it, if it is desired sometimes, make sure that the directory may be created during the init

if create_directory:
panda_directory = f"{directory}/{self.resource_dir}"
# At some point in the future, ophyd_async will have the feature to create the requested directory
if not os.path.isdir(panda_directory):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is in the Hyperion/blueapi container: which user does Hyperion run as? blueapi runs as a kubernetes user without file system permissions as far as possible

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I hadn't considered that, Hyperion is running on a control machine so should have permissions. it might be better to just stick this part within a Hyperion plan

Copy link
Contributor

Choose a reason for hiding this comment

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

Running as gda2?

Either way, if it's in the plan or the DirProvider it'll need to be running as a user that can write to the visit directory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, as gda2. We can either check, in dodal, if the user has permission to create a directory if create_directory=True before trying to create it, or have the logic in Hyperion where the user will always be able to. I think Hyperion is better for now, can always change later

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved the logic to Hyperion so this PR is pretty tiny now!

@olliesilvester olliesilvester force-pushed the hyperion_1339_fix_panda_pcap branch from c508ee5 to ce03053 Compare May 13, 2024 13:40
@olliesilvester olliesilvester changed the title Give PandASubdirectoryProvider option to create directory Change logging level on PandASubdirectoryProvider May 13, 2024
@olliesilvester olliesilvester force-pushed the hyperion_1339_fix_panda_pcap branch from 29c076b to 4974999 Compare May 15, 2024 07:38
Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Great, thank you.

@olliesilvester olliesilvester dismissed DiamondJoseph’s stale review May 16, 2024 13:59

Addressed comments

@olliesilvester olliesilvester merged commit 50d0fe4 into main May 16, 2024
11 checks passed
@olliesilvester olliesilvester deleted the hyperion_1339_fix_panda_pcap branch May 16, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants