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

Passing parameters to a protocol? #14

Open
morefigs opened this issue Dec 13, 2023 · 3 comments
Open

Passing parameters to a protocol? #14

morefigs opened this issue Dec 13, 2023 · 3 comments

Comments

@morefigs
Copy link

morefigs commented Dec 13, 2023

I wish to pass a parameter to a protocol after it has been uploaded to the robot. This would allow things like changing how many wells are dispensed into without having numerous similar protocols.

What is the recommended way (if any) to pass parameters that can be read by a protocol file?

I can't see an obvious way of passing parameters to the protocol file when uploading a protocol (POST /protocols) or creating a run for a protocol (POST /runs) via the HTTP API.

Ultimately I want the protocol to be able to accept parameters like this:

from opentrons import protocol_api

def run(protocol: protocol_api.ProtocolContext, num_wells: int):
    # use `num_wells`...

I noticed that protocol has a bundled_data attribute, but that only seems to be useable when uploading a protocol via the CLI and not the HTTP API, correct?

@morefigs
Copy link
Author

morefigs commented Jan 5, 2024

For anyone with the same problem my workaround was to dynamically inject parameter values into the Python protocol file before uploading: https://github.com/morefigs/opentrons-http-api/blob/main/examples/robot_client/upload_parameterized_protocol.py.

@MetsvR
Copy link

MetsvR commented Apr 24, 2024

Hey, I'm running into similar issues where I want to run multiple protocols dynamically after each other but want to use parameters to keep track of used tips, however the page you're referring too seems to be lost. Do you still have the working method or something similar that works?

@morefigs
Copy link
Author

@MetsvR I ended up developing a private solution to this, feel free to email me at my username at gmail if you'd like to chat offline about it.

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