Skip to content

[Harvester] Set crystal UUID via set_id so get_id() returns it correctly#1640

Open
jbflo wants to merge 2 commits into
developfrom
jb-fix-harvester2
Open

[Harvester] Set crystal UUID via set_id so get_id() returns it correctly#1640
jbflo wants to merge 2 commits into
developfrom
jb-fix-harvester2

Conversation

@jbflo

@jbflo jbflo commented Jul 16, 2026

Copy link
Copy Markdown
Member

sample.id = x_tal_uuid was setting a dynamic attribute, causing get_id() to return None since it reads self._id

Fix: Add public set_id() to Component
use sample.set_id(x_tal_uuid) so get_id() returns the crystal UUID consistently

@jbflo
jbflo force-pushed the jb-fix-harvester2 branch 2 times, most recently from c7dd05c to 2af998e Compare July 16, 2026 15:34

# Enrich sample object in MXCuBE
sample.id = x_tal_uuid
sample._id = x_tal_uuid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Its a bit odd to set _id from outside of sample, is there no set_id or similar that can be used ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Its a bit odd to set _id from outside of sample, is there no set_id or similar that can be used ?

pragmatic but accessing a protected attribute from outside the class is odd i aggreed.

But I checked — there's no set_id(). The options are:

Keep the pragmatic fix or
Add set_id() to Component.py — cleanest, fixes the root cause:

def set_id(self, id):
self._id = id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, go AI go, do the fix ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, go AI go, do the fix ;)

fixed ! 🤖

@jbflo
jbflo force-pushed the jb-fix-harvester2 branch from 2af998e to e105259 Compare July 17, 2026 13:36
@jbflo jbflo changed the title [Harvester] Set crystal UUID via _id so get_id() returns it correctly [Harvester] Set crystal UUID via set_id so get_id() returns it correctly Jul 17, 2026
Comment thread mxcubecore/HardwareObjects/abstract/sample_changer/Component.py Outdated
Comment thread mxcubecore/HardwareObjects/abstract/sample_changer/Component.py Outdated
@jbflo
jbflo force-pushed the jb-fix-harvester2 branch from e105259 to c3d1ff3 Compare July 17, 2026 14:08
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.

2 participants