sdl2: add support to start multiple services#608
Merged
Conversation
use service name as log tag
Contributor
|
Looks mostly good so far, but I'm having an issue with one of my services not being able to import some modules (not sure why, as the main app imports the modules fine, as do the other services). I did add some changes to use different log tags for the services. |
Member
Author
|
Looking good for the logtag! On my side, i did make a library more "official" and clean to use them: Maybe that would be good to put it under kivy umbrella? |
Contributor
|
I think that servicelib could be a good addition. It won't handle all cases, but it will work great when you just need a cross-platform multiprocessing type solution. |
kived
added a commit
that referenced
this pull request
Jan 25, 2016
sdl2: add support to start multiple services
Contributor
|
👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current service approach is automatic, and supports only one service if there is a
service/main.pyfile in the application.This approach is complementary, and allow the user to declare multiple others services from name + entrypoint:
build.pyhave a new--service name:entrypoint.pyoption that can be used multiple time1.1 it will generate appropriate service file out of the
Service.tmpl.javaintoyour.package.ServiceNAME1.2 it will declare the service in the
AndroidManifest.xmlPythonActivity.start_serviceandPythonActivtiychanged to pass the default entrypoint (either main.pyo or service/main.pyo).start.cis changed to use the entrypoint that we passed along. It as mangling to either use pyo in priority, or fallback to py if pyo is not found.Note that if you declare a name "S1", the java service will be named "ServiceS1", and your name will be capitalized (to have a correct java classname)
They are declared to run as separated process from the application. So it's up to you to came with a communication layer between your application and services. The stop method kill the process, without any warning. Use your own communication layer first to soft kill before doing stop.
Any call to start without stop will have no effect.
Usage example:
Building:
Pure python usage: