No Unassigned Resource of Type XXX Available

I’m currently encountering some strange behavior when using resource_list_with_prefix. I have a video link here that demonstrates it.

It is mostly self-explanatory, but basically it won’t recognize all of the available labware that I place on the deck. The video shows 4x carriers called “FalconCarrier_X”, where X is 1, 2, 3 or 4. It recognizes up to two of them but fails to recognize the others. I’ve tried to replicate the behaviour but it seems to be somewhat random, or at least I can’t fully reproduce it. Sometimes it will recognize 3 of them, other times 2.


The above is a message I shared with Stefan, which I am now sharing here for visibility in the community. It is an ongoing issue for me so if anyone else can explain it then please let me know!

For reference, the method files are available here if anyone wants to recreate the issue.

Hi, it’s not quite possible for me to reproduce your error without the resource classes and labware definitions you use. If you fork the Github with your PyHamilton repo and send me the Venus labware definitions you use in your method, I think that will be enough

In the meantime, your error is being raised somewhere in these lines of code, 192-199 in deckresource.py.

matching_ress = []
        for line in self.lines:
            if restype.test(line):
                match_name = restype.extract_name(line)
                if match_name in self.resources:
                    continue
                matching_ress.append(restype.resource_class(match_name))

Basically we are looping over every line in the .layfile text encoding and testing whether a line contains your named resource e.g. FalconCarrier_2. If it does, we append to our LayourManager.resources dictionary. For some reason, it either isn’t realizing when a line contains your deck resource ID when it really does, or it thinks it has already instantiated that deck resource. Maybe try throwing in some print statements for debugging purposes?

Also, you might try instantiating single resources with LayoutManager.assign_unused_resource(…) and see if that gives anything different. The usage of that function in this case will be:

lmgr.assign_unused_resource(ResourceType(Falcon24, "FalconCarrier_2"))

1 Like

Will get cracking on this when I’m back in the lab next week

1 Like

Hi Stefan

Sorry for taking so long to get back to you here. You can find the FalconCarrier24 definition in the pull request I just submitted. I have shared the .lay and .res files with your email address so you should be able to access them via GDrive.

I am still getting the same behaviour. resource_list_with_prefix is still only allowing me to identify up to 2 of the falcon carriers. Your suggestion of using

lmgr.assign_unused_resource(ResourceType(Falcon24, "FalconCarrier_2"))

works well and allows me to work with all four of the falcon carriers that I have on the deck. Below is my non-functional (& commented out) use of resource_list_with_prefix, followed by your suggestion, which works.
image

I haven’t yet explored what’s happening under the hood in lines 192-199 in deckresource.py, I hope to get to that next!

Ok thanks! No need to make a pull request yet (something is clearly broken), so I will just switch to the branch you created and work from there. Once everything works then I will pull your code with the new resources in.

1 Like

After a lot of review it seems that there is some difference in your layfile’s text encoding vs. what is typically parsed by resource_list_with_prefix. Somehow this only applies in your case, but it is an insufficiency on the part of that function and its complicated inner workings.

I’m 99% sure you can recover the same functionality by simply writing a list comprehension over lmgr.assign_unused_resource(...). I’ll encourage users to try that from now on.

EDIT: I pulled your changes and the repo now includes your labware definitions.