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

Logic Error in Qcodes Session Creator? #71

Open
samantha-ho opened this issue Nov 6, 2024 · 4 comments
Open

Logic Error in Qcodes Session Creator? #71

samantha-ho opened this issue Nov 6, 2024 · 4 comments

Comments

@samantha-ho
Copy link

samantha-ho commented Nov 6, 2024

I believe I've found a logic error in the ZISession class which is used to create toolkit sessions for the Qcodes instrument instances.

The error is in the following code block:

        if not new_session:
            for instance in Session.instances():
                if instance.server_host == server_host and (
                    instance.is_hf2_server == hf2
                    or server_port is None
                    or instance.server_port == server_port
                ):
                    return instance

If I attempt to instantiate two MFLIs on different ziDataServer ports, and I do not use the new_session keyword argument, the instance.is_hf2_server == hf2 flag causes the 2nd MFLI to end up on the same session and port as the first instance, even though I explicitly set different ports.

If I do use the new_session keyword, then I cannot have more than one MFLI on the second ziDataServer port on the same session.

@mehdialem
Copy link
Collaborator

Thank you, @samantha-ho, for reporting this issue. We are on it and we'll provide the fix as soon as our tests confirm it.

To better understand your use case, I assume you have multiple MFLIs and you'd like to synchronize them in multiple MDS clusters where each group of MFLIs are synchronized independently from the other groups.

@samantha-ho
Copy link
Author

That's correct. I have 4-6 MFLIs, and I'd like to sync them in pairs. I received some guidance from a ZI engineer on how to accomplish this, and in implementing their suggestion, ran into this issue.

@samantha-ho
Copy link
Author

samantha-ho commented Nov 6, 2024

With a little more thought, I think it should be:

if instance.server_host == server_host and (
    instance.is_hf2_server == hf2) and (
    server_port is None
   or instance.server_port == server_port
):

But I don't have any experience with HF2 servers

@samantha-ho
Copy link
Author

Also, here is a minimal code fragment that reproduces the problem

from zhinst.qcodes import MFLI

mfli1 = MFLI(serial="DEV6890", host="localhost", interface="1GbE", port=8004)
mfli2 = MFLI(serial="DEV6504", host="localhost", interface="1GBE", port=8008)

assert mfli1.session.server_port == 8004
assert mfli2.session.server_port == 8008

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

No branches or pull requests

2 participants