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
Python #2135
Python #2135
Conversation
@tom-wa this should make the python plugin stable. I have not tested it, though. |
@ingwinlu Do you know how we can make the python unit tests locate their respective "kdb module" (both version 2 and 3). I still do not understand why we do not install Elektra to /usr/local, wouldn't that be much easier? Then such things would work out of the box. |
@e1528532 did I use pluginprocess correctly? I do not quite understand why ELEKTRA_PLUGINPROCESS_OPEN gets implicitely called but not ELEKTRA_PLUGINPROCESS_CLOSE? And in line 384 of src/libs/pluginprocess/pluginprocess.c, shouldn't that be ELEKTRA_PLUGINPROCESS_CLOSE instead of ELEKTRA_PLUGIN_CLOSE? |
92962fa
to
231a275
Compare
jenkins build all please |
@sanssecours Do you have any idea why "swig3.0 -c++ -python -external-runtime runtime.h" does not produce runtime.h under Mac OS X? Or is there some other reason why https://travis-ci.org/ElektraInitiative/libelektra/jobs/409880622 fails? @ingwinlu Seems like "Pull docker images" hangs? |
nothing hangs. 36 builds in queue as we have taken down v2 for benchmarking one of our plugins. |
?
How does the build server come up with this high number, these are much more jobs than PRs which had activity today. Would be great if this PR can be merged today, I need Debian packages of it and unfortunately there is no easy way to create Debian packages without merging to master. |
because our builds run in parallel. each parallel stage adds 1 to the number.
pretty sure master is broken since the yaml merge.
that was a compromise to not have even more builds that the system can't handle. It can be rewritten to build all the time with the obvious downside of slowing down the overworked system even more. |
I thought the multiple repos are the problem. (PRs should not overwrite the packages of master.)
This can be fixed with more hardware. When v2 is running we usually do not have any problems anyway. |
Nope, sorry.
Not as far as I can tell. |
What happens when the above command is executed? Maybe we use a wrong version of swig? With "3.0.10" on Linux it works without problems. The alternative would be to disable the python plugins for Mac OS X... |
The Homebrew formula of SWIG does not include a binary called find (brew --cellar swig) -regex '.*bin.*'
#> /usr/local/Cellar/swig/3.0.12/bin
#> /usr/local/Cellar/swig/3.0.12/bin/swig
#> /usr/local/Cellar/swig/3.0.12/bin/ccache-swig .
An easier alternative would be to just remove the Python configuration from |
Might also be called differently, SWIG_EXECUTABLE of CMakeCache.txt should tell you which one is used.
Even if we know it does not compile? Its status reads "maintained unittest configurable global memleak" so people would not expect it to not work. |
The command
In that case let us also disable the Python binding on macOS. As it stands we do not have a maintainer for the macOS version of the binding anyway. |
Ok, then let us disable the python binding for the GCC build in Mac OSX. Thank you for your investigation! |
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 do not quite understand why ELEKTRA_PLUGINPROCESS_OPEN gets implicitely called but not ELEKTRA_PLUGINPROCESS_CLOSE?
I think the reason was that i already return an boolean (represented as int) in the close function but i also need the result of the "remote call" in that context, so the function would have had to return two values. thinking about it again one could probably just use a tuple (probably a struct in c) to return both values.
And in line 384 of src/libs/pluginprocess/pluginprocess.c, shouldn't that be ELEKTRA_PLUGINPROCESS_CLOSE instead of ELEKTRA_PLUGIN_CLOSE?
yes you are right i also used ELEKTRA_PLUGINPROCESS_CLOSE in the haskell plugin, please feel free to correct the issue
Regarding the fix for the original key name issue, in theory it looks fine to me apart from a few minor things. i haven't tried it out yet though on my own machine, i assume it should work?
@@ -164,7 +164,7 @@ Thanks to Daniel Bugl. | |||
### Interpreter Plugins | |||
|
|||
- The plugins ruby, python and jni can now also be mounted as global plugin. | |||
- Fix crash in python plugin. *(Markus Raab)* | |||
- Fix crash in python plugin by using process plugin. *(Markus Raab)* |
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.
the library is currently called pluginprocess, the process plugin is the plugin that uses this library for generic wrapping of other plugins instead. This could probably be misleading therefore.
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.
Thank you! My initial plan was to use the process plugin but this changed now.
Can you maybe create a new PR fixing the pluginprocess #2142? If it is useful for you can cherry-pick my commits in this PR.
static Key * popParent (KeySet * ks) | ||
{ | ||
Key * parentKey = ksLookupByName (ks, "/pluginprocess/parent", KDB_O_POP); | ||
Key * parentNameKey = ksLookupByName (ks, "/pluginprocess/parent/name", KDB_O_POP); |
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.
minor thing but above the variable is called nameKey and here its parentNameKey, i'd unify that
src/plugins/python/python.cpp
Outdated
if (!elektraPluginProcessIsParent (pp)) elektraPluginProcessStart (handle, pp); | ||
} | ||
|
||
moduleData * data = static_cast<moduleData *> (elektraPluginGetData (handle)); |
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.
minor optimization: store the result of elektraPluginGetData before the if, so you don't need to call the function again here like its done in the haskell plugin
src/plugins/python/python.cpp
Outdated
moduleData * md = createModuleData (handle); | ||
if (!md) | ||
{ | ||
if (ksLookupByName (elektraPluginGetConfig (handle), "/module", 0) != nullptr) |
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.
in case the creation of md fails, pp (pluginprocess) is not cleaned up. you should call elektraPluginProcessClose for that.
src/plugins/python/python.cpp
Outdated
if (elektraPluginProcessIsParent (pp)) | ||
{ | ||
int result = elektraPluginProcessSend (pp, ELEKTRA_PLUGINPROCESS_CLOSE, NULL, errorKey); | ||
if (elektraPluginProcessClose (pp, errorKey)) elektraPluginSetData (handle, NULL); |
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.
is it a good idea to set the plugin's handle to null? this only means the pluginprocess struct (pp) got cleaned up and could be removed from the plugin's other data (in this plugin it seems to be this moduleData struct, so make moduleData.pp null instead and cleanup the rest of the plugin at a central point.
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.
It was copied from the example. Shouldn't elektraPluginProcessClose be called in both parent & child?
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.
well the child process gets killed anyway so it shouldn't make much of a difference
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.
ok the child does call cleanupPluginData at the end of elektraPluginProcessStart so it should be fine.
It would be great if you can do the necessary fixes processplugin.
It improves one specific problem but I am afraid there are other problems with the current protocol. The library also needs more unit tests. |
regarding elektraPluginProcessClose not implicitly sending the ELEKTRA_PLUGINPROCESS_CLOSE command due to the necessity of a tuple containing (result, cleanedUp) otherwise, should i change this or leave it like it is? It would require changing the header. |
e863158
to
482d662
Compare
to make module/plugin loading more robust
…s in its own process now, doesn't matter anymore)
Finally it is done 👍 If someone is interested why there are two travis jobs, one is because of "Build pushed branches" and the other because of the pull request (branches merged into master). |
Basics
Do not describe the purpose here but:
doc/news/_preparation_next_release.md which contains
*(my name)*
)Please always add something to the the release notes.
(first line should have
module: short statement
syntax)close #X
, should be in the commit messages.Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
Review
Remove the line below and add the "work in progress" label if you do
not want the PR to be reviewed:
@markus2330 please review my pull request