nanoporetech / minknow_api

Protobuf and gRPC specifications for the MinKNOW API
Other
51 stars 12 forks source link

Example for stop_protocol #3

Closed harisankarsadasivan closed 5 years ago

harisankarsadasivan commented 5 years ago

To start a protocol, it is sufficient that we do the following:

//Find a protocol to start from the available list
protocol_to_start = find_protocol(
    available_protocols,
    flow_cell="FLO-MIN106",
    kit="SQK-LSK108",
    experiment_type="sequencing")
print("Starting protocol: %s" % protocol_to_start.name)

// Construct a user info message to control the protocol group id
protocol_user_info = protocol.ProtocolRunUserInfo(
    # We need to specify StringValue as the group_id uses a nullable wrapper type
    protocol_group_id=StringValue(value="My Experiment Group")
)

// Construct a start protocol message to send to MinKNOW
start_request = protocol.StartProtocolRequest()

// Set the protocol identifier in the start message
/// Start the first protocol in the returned list

start_request.identifier = protocol_to_start.identifier
start_request.user_info.CopyFrom(protocol_user_info)

// Send the start protocol and wait for the response
started_protocol = stub.start_protocol(start_request)
print("Started protocol run_id: %s" % started_protocol.run_id)

Could you kindly give an example of how to stop the same protocol? @jorj1988 @iiSeymour

iiSeymour commented 5 years ago

Hey @harisankarsadasivan just construct and send a StopProtocolRequest like:

stop_request = protocol.StopProtocolRequest()
stub.stop_protocol(stop_request)
harisankarsadasivan commented 5 years ago

@iiSeymour can I do this even with a test cell loaded instead of a flow cell?

iiSeymour commented 5 years ago

Yes, but as per #2 you will want to check a protocol is running before stopping.