nanoporetech / minknow_api

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

Using this API for run until (not read until) #1

Closed harisankarsadasivan closed 5 years ago

harisankarsadasivan commented 5 years ago

Where do I start and how do I use this API for run until? Can this be captured in the documentation or may I get some quick hints on this?

harisankarsadasivan commented 5 years ago

I figured out that there is something as follows in the protocol buffer message class description: // Stops the currently running protocol script instance. rpc stop_protocol (StopProtocolRequest) returns (StopProtocolResponse) {}

inside the script: minknow_api/minknow/rpc/protocol.proto . This seems to tell me that stopping the protocol implies stopping a run. Could you tell me the commands I should use to stop a sequencing run?

0x55555555 commented 5 years ago

To stop a sequencing run you can call the stop_protocol, the control script will end, and the sequencing run will finish. This will be exactly like you pressed stop in the GUI.

0x55555555 commented 5 years ago

You can call acquisition.get_acquisition_info in order to query for fields you can use for run until. The yield_summary section of the returned acquisition.AcquisitionRunInfo message contains information about the current run you could use to inform a run until decision.

I will endeveour to get these functions added to the examples section of this repo for a future release.

harisankarsadasivan commented 5 years ago

@jorj1988 Thank you. Could you tell me what I should do after "mkdir -p grpc_api/; protoc --python_out=grpc_api/ minknow/rpc/*.proto"? I'm left clueless as to how to proceed to call stop_protocol

iiSeymour commented 5 years ago

Hey @harisankarsadasivan

The protoc command creates the python interface from the .proto files. The next best thing is to take a look at the example for starting a protocol.

harisankarsadasivan commented 5 years ago

@iiSeymour @jorj1988 I tried going to the examples folder and completed lines 1 to 19 in minknow_api/examples/list_devices.py. Now, I have /examples/generated/ containing the API. But, when I run python3 list_devices.py using Python3.6.7, I get the following error:

File "list_devices.py", line 32, in <module>
    import minknow.rpc.manager_pb2 as manager
  File "generated/minknow/rpc/manager_pb2.py", line 16, in <module>
    from minknow.rpc import instance_pb2 as minknow_dot_rpc_dot_instance__pb2
  File "generated/minknow/rpc/instance_pb2.py", line 16, in <module>
    from minknow.rpc import acquisition_pb2 as minknow_dot_rpc_dot_acquisition__pb2
  File "generated/minknow/rpc/acquisition_pb2.py", line 27, in <module>
    dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,])
TypeError: __new__() got an unexpected keyword argument 'serialized_options'.

Is this something to do with my protoc version?I have installed 3.5.1 itself.

iiSeymour commented 5 years ago

The protobuf library you have is probably too old for the version of protoc you are using. Can you run pip freeze | grep proto and check?

harisankarsadasivan commented 5 years ago

protobuf==3.8.0 is what is returned when I do that. my libprotoc is 3.5.1. what should I do next? I used this to install protoc:

curl -OL https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip

unzip protoc-3.5.1-linux-x86_64.zip -d protoc3

sudo mv protoc3/bin/* /usr/local/bin/

sudo mv protoc3/include/* /usr/local/include/

harisankarsadasivan commented 5 years ago

I tried installing protoc 3.8.0 and protobuf 3.8.0, but to no use.

harisankarsadasivan commented 5 years ago

solution: protobuf is 3.8.0 and libprotoco is upgraded to 3.9.0 . to resolve missing rpc libraries, I did