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

grpc : Dynamic plugin loading #143

Merged
merged 4 commits into from
Nov 13, 2017
Merged

grpc : Dynamic plugin loading #143

merged 4 commits into from
Nov 13, 2017

Conversation

Rjasuja
Copy link
Contributor

@Rjasuja Rjasuja commented Oct 27, 2017

Split proto files(one for each plugin), load plugins based on plugins.conf file

@Rjasuja
Copy link
Contributor Author

Rjasuja commented Oct 27, 2017

For now conf file is kept simple with plugin name in each new line, other option is to have xml file and have xml parser included.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 48.634% when pulling 7f63bed on grpc into 97d98b9 on develop.

@julianoes
Copy link
Collaborator

For now conf file is kept simple with plugin name in each new line, other option is to have xml file and have xml parser included.

We will have a xml parser included once the camera definition stuff is added that you could use.

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks @Rjasuja. I think this is going in the right direction. I left some comments about next steps that I see.

--python_out=.
--grpc_python_out=.
${proto_dir}/telemetry.proto
DEPENDS ${proto_dir}/telemetry.proto
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With cmake you can list all files in a directory and loop over them.

--plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN}
--cpp_out=. ${proto_dir}/action.proto
DEPENDS ${proto_dir}/action.proto
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, here I suggest to loop over the files automatically.


};

class ActionRPCImpl final : public ActionRPC::Service
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these classes should be in separate files and then inside the respective plugin folder.

@@ -0,0 +1,51 @@
syntax = "proto3";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these proto files should be moved to the respective plugin folders.

map_type map;
map["action"] = &createInstances<ActionRPCImpl>;
map["mission"] = &createInstances<MissionRPCImpl>;
map["telemetry"] = &createInstances<TelemetryRPCImpl>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be auto-generated in the same way as the plugins are currently added to device_impl.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julianoes createInstance takes class name as parameter, if not here somewhere there should be mapping between string to class name. Any other way we could do without hardcoded mapping.

Thanks for the review, we will address other comments in next submission.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 48.634% when pulling 8b20aa7 on grpc into 97d98b9 on develop.

@avinash-palleti
Copy link
Contributor

@julianoes Can you review the changes. If this is fine, we can go ahead for multiple device handling implementation through gRPC.

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a some comments. If you can address them or at least add todos, I think it's fine to merge this and move ahead.

mission.pb.cc # generated
mission.grpc.pb.cc # generated
telemetry.pb.cc # generated
telemetry.grpc.pb.cc # generated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also generate that list using the same foreach. You just add it to all to a variable.

map_type map;
map["action"] = &createInstances<ActionRPCImpl>;
map["mission"] = &createInstances<MissionRPCImpl>;
map["telemetry"] = &createInstances<TelemetryRPCImpl>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you agree?

rpc Land(ActionEmpty) returns(ActionResult) {}
}

// FIXME these different Empty types are ugly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a protobuf empty that we should reuse: import "google/protobuf/empty.proto";.

rpc TelemetryPositionSubscription(TelemetryEmpty) returns(stream TelemetryPosition) {}
}

message TelemetryEmpty {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also re-use empty here.

@mrpollo
Copy link
Member

mrpollo commented Nov 6, 2017

Same comments as @julianoes , thanks for the PR @Rjasuja

@coveralls
Copy link

Coverage Status

Coverage decreased (-31.06%) to 17.571% when pulling 7a3b194 on grpc into 97d98b9 on develop.

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one small comment.


using grpc::Status;
using grpc::ServerContext;
using dronecorerpc::ActionRPC;
using dronecorerpc::ActionEmpty;
using dronecorerpc::Empty;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line still needed?

@Rjasuja
Copy link
Contributor Author

Rjasuja commented Nov 8, 2017

Removed.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 17.571% when pulling 110df51 on grpc into 762c327 on develop.

@Rjasuja
Copy link
Contributor Author

Rjasuja commented Nov 8, 2017

@julianoes Added cmake file for automated generation of plugin objects. Please review.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 17.571% when pulling 010a7a0 on grpc into 762c327 on develop.

@julianoes
Copy link
Collaborator

@Rjasuja cool thanks, this looks better! Can you merge or rebase with develop and check the CI issues please?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 17.571% when pulling 3582bc9 on grpc into 670b15f on develop.

Split proto files(one for each plugin), load plugins based on plugins.conf file
Modify Cmake to automatically generate plugins
Move respective plugins in specific directories
Create a list of generated source files for all the plugins
Add plugin name in plugins.conf to enable the plugin
Mapping table will generate object for the respective plugin and register the service
@coveralls
Copy link

Coverage Status

Coverage remained the same at 17.571% when pulling 876d989 on grpc into 54890a2 on develop.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 17.571% when pulling 761e301 on grpc into 54890a2 on develop.

@julianoes julianoes merged commit 3f51147 into develop Nov 13, 2017
@julianoes julianoes deleted the grpc branch November 13, 2017 14:02
@julianoes
Copy link
Collaborator

Thanks @Rjasuja!

@julianoes julianoes mentioned this pull request Nov 27, 2017
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

Successfully merging this pull request may close these issues.

5 participants