Skip to content

Delegate emission of "end load" signal to the "SampleChanger" component #1825

@alessandro-olivo

Description

@alessandro-olivo

In the file mxcubeweb/core/components/samplechanger.py I noticed that although the mount_sample_clean_up function emits both the "start" and "end" signals to handle the frontend popup, this doesn’t happen in the "unmount" function, where the "start" signal is emitted BUT the "end" signal is only emitted for "manual" samples so in the other case it's up to the "SC HWO" to emit the "end" signal.

Wouldn’t it make more sense to emit the "end" signal directly from the samplechanger.py also in the unmount_sample_clean_up function ?
Is there something that I'm missing ?

Here my suggested changes (in mxcubeweb/core/components/samplechanger.py) :

def unmount_sample_clean_up(self, sample):
        from mxcubeweb.routes import signals

        try:
            signals.sc_unload(sample["location"])

            if sample["location"] != "Manual":
                HWR.beamline.sample_changer.unload(sample["location"], wait=False)
            else:
                self.set_current_sample(None)
-               signals.sc_load_ready(sample["location"])  
            msg = "[SC] unmounted %s" % sample["location"]
            logging.getLogger("MX3.HWR").info(msg)
        except Exception:
            msg = "[SC] sample could not be mounted"
            logging.getLogger("MX3.HWR").exception(msg)
            raise
        else:
            HWR.beamline.queue_model.mounted_sample = ""
            HWR.beamline.sample_view.clear_all()
+       finally:
+           signals.sc_load_ready(sample["location"])

Thoughts

To be more consistent with the unmount procedure, maybe we should add a new signal, something like this: signals.sc_unload_ready(sample["location"]), instead of the current signals.sc_load_ready(sample["location"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions