Open
Conversation
Member
Author
|
example of # updated AnnoyBackend:
class AnnoyBackend(LiquidHandlerChatterboxBackend):
async def pick_up_tips(self, ops, use_channels, **backend_kwargs):
print("called with", ops, use_channels)
if 1 in use_channels:
raise ValueError("Channel 1 is not available")
if ops[0].resource.get_identifier() == "A1":
raise ChannelizedError(
{0: "A1 is not supported"},
)
await super().pick_up_tips(ops, use_channels, **backend_kwargs)
############################
# custom error handler
async def different_channel(func, error, **kwargs):
kwargs["use_channels"] = [0]
return await func(**kwargs)
# setting an error handler on LH and picking up a tip from A1
from pylabrobot.error_handling import choose_handler
from pylabrobot.liquid_handling.error_handlers import try_next_tip_spot
error_handler = choose_handler(
{
ValueError: different_channel,
ChannelizedError: try_next_tip_spot(iter(tip_rack["B1:H1"])),
}
)
await lh.pick_up_tips(tip_rack["A1"], use_channels=[1], error_handler=error_handler) |
Member
Author
|
added Here's an example: # updated AnnoyBackend:
class AnnoyBackend(LiquidHandlerChatterboxBackend):
def __init__(self):
super().__init__()
self.n = 0
async def pick_up_tips(self, ops, use_channels, **backend_kwargs):
self.n += 1
if self.n < 4:
raise ValueError("n is too low: {n}".format(n=self.n))
return await super().pick_up_tips(ops, use_channels, **backend_kwargs)
############################
# use until_success with basic_retry_handler
from pylabrobot.error_handling import until_success, basic_retry_handler
error_handler = until_success(basic_retry_handler, max_tries=2)
await lh.pick_up_tips(tip_rack["A1"], use_channels=[1], error_handler=error_handler) |
49a6770 to
159fd78
Compare
bffeb24 to
a1d61b7
Compare
1675cd6 to
2b2f7f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
we are still thinking about implementing a general purpose error handler. see the thread here. See one possible option implemented partially in #507.
In this PR i implemented option 3 of that thread: an
error_handlerargument for each method in every front end.a very similar example of usage as before in #507:
let's discuss whether this is a good option in the error handling thread on the forum. specific implementation details are to be discussed after we decide what the api should look like