-
Notifications
You must be signed in to change notification settings - Fork 125
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
Added plugins feature that allows separate binaries as processes #58
base: parser
Are you sure you want to change the base?
Conversation
Used the loader which was compiled out, and had to brutilize it a bit Need a conversation about what the intention was of some of the non-working code i it
The first layer of management is that parameters can be passed to the Plugins via the Json graph, under an optional Parameters field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @dahvid ! Thanks for your Pull Request and sorry for a late reply.
If I understood correctly, Plugins are Components that can be compiled separately from the application and loaded at run-time from shared libraries. I think it's a great contribution!
This PR needs further work to be merged to the main repo:
- It would be nice to add some explanation in the description of this PR on what "plugins" are, when and how to use them.
- Could you base it on
master
branch rather thanparser
?parser
is WIP and it doesn't seem like these changes really depend on it. - Could you please make sure the tests pass and that test coverage remains at ~90% level?
- Please add descriptive godoc strings to all exported types and functions.
See more comments inline.
@@ -89,6 +89,11 @@ func (n *Graph) Add(name string, c interface{}) error { | |||
return nil | |||
} | |||
|
|||
// Get a component by name | |||
func (n *Graph) Get(name string) interface{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is ambiguous. I'd suggest calling it GetProcess()
instead.
// Parse JSON into Go struct | ||
var descr graphDescription | ||
err := json.Unmarshal(js, &descr) | ||
if err != nil { | ||
fmt.Println("Error parsing JSON", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clean up all debug prints before merging, and make use of error
to return errors to caller.
const plugInSuffix = `_goplug.so` | ||
|
||
//PlugIn something | ||
type PlugIn interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are params
mandatory for all plugins? Can't we just load any components as plugins? Forcing all plugin components adhere to this interface is quite restrictive.
Also, I have a strong feeling that Parameters
is reinventing IIPs. In FBP, IIPs (initial IPs) are used to send pre-defined input to components. See graph_iip_test.go for example.
@@ -0,0 +1,5 @@ | |||
#!/bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this file should live in test_plugins/
.
Hi Vladimir,
Yes, of course, I sort of pushed it just to see if there was anybody alive
there! For the use case in my tests IIP's would work, but in the real
world there are all kinds of configuration information you want to pass a
component (I've built several commercial and research systems like this).
It seems awkward to have to create a special input channel that will only
receive data once. If I remember correctly the master branch didn't have a
function for loading a graph from JSON, which is essential for my current
use case for goflow. There are a few other problems with my request.
1. Goflow plugins are partly broken. They have a weird hash function in
plugin.go that checks, something, not clear what. It's supposed to check
if the plugin was compiled with the same version as the current go, but
doesn't. It seems to me to reject plugins more or less randomly. I had to
comment out the hash check in th plugin.go, to get it to work
consistently. Most people have given up on .so plugins because of this. I
also think it might be better to just allow compiled in plugins like you
had at first.
2. I'm trying to move to a more managed plugin model than just Process().
Maybe this should be built outside of goflow?
I'll try to fix some of these issues this week. But probably we need to
have a conversation about your goals and I'll understand better what should
be inside or outside the main project.
Regards,
David
…On Sat, Oct 10, 2020 at 3:38 PM Vladimir Sibirov ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Hello @dahvid <https://github.com/dahvid> ! Thanks for your Pull Request
and sorry for a late reply.
If I understood correctly, Plugins are Components that can be compiled
separately from the application and loaded at run-time from shared
libraries. I think it's a great contribution!
This PR needs further work to be merged to the main repo:
1. It would be nice to add some explanation in the description of this
PR on what "plugins" are, when and how to use them.
2. Could you base it on master branch rather than parser? parser is
WIP and it doesn't seem like these changes really depend on it.
3. Could you please make sure the tests pass and that test coverage
remains at ~90% level?
4. Please add descriptive godoc strings to all exported types and
functions.
See more comments inline.
------------------------------
In graph.go
<#58 (comment)>:
> @@ -89,6 +89,11 @@ func (n *Graph) Add(name string, c interface{}) error {
return nil
}
+// Get a component by name
+func (n *Graph) Get(name string) interface{} {
This name is ambiguous. I'd suggest calling it GetProcess() instead.
------------------------------
In loader.go
<#58 (comment)>:
> // Parse JSON into Go struct
var descr graphDescription
err := json.Unmarshal(js, &descr)
if err != nil {
+ fmt.Println("Error parsing JSON", err)
Please clean up all debug prints before merging, and make use of error to
return errors to caller.
------------------------------
In plugins.go
<#58 (comment)>:
> @@ -0,0 +1,78 @@
+package goflow
+
+import (
+ "fmt"
+ "io/ioutil"
+ "path"
+ "plugin"
+ "strings"
+)
+
+const plugInSuffix = `_goplug.so`
+
+//PlugIn something
+type PlugIn interface {
Are params mandatory for all plugins? Can't we just load *any* components
as plugins? Forcing all plugin components adhere to this interface is quite
restrictive.
Also, I have a strong feeling that Parameters is reinventing IIPs. In
FBP, IIPs (initial IPs) are used to send pre-defined input to components.
See *graph_iip_test.go* for example.
------------------------------
In make_plugs.sh
<#58 (comment)>:
> @@ -0,0 +1,5 @@
+#!/bin/bash
I believe this file should live in test_plugins/.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#58 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWSOM7MG6Y62MH65W3M2FDSKBIULANCNFSM4RVV5Y3Q>
.
|
Re: IIPs vs.
|
Used the loader.go which was not compiled, I had to brutalize it a bit, to get it to work with plugins.
Need a conversation about what the intention was of some of the non-working code in it.