-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: Add more events for starting and stopping of worker #187
Conversation
Output on terminal with echo worker:
Output on terminal with
|
8b6314f
to
e4e2a48
Compare
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.
Works great! Can we follow this up with a PR that re-emits these events on the public com.redhat.Yggdrasil1
D-Bus interface?
ipc/interfaces.go
Outdated
WorkerEventNameWorking WorkerEventName = 3 | ||
|
||
// WorkerEventNameStarted is emitted when finished starting | ||
// process and it can |
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.
Looks like you left off the remainder of the documentation sentence.
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.
Good catch. I was probably distracted by somebody, when I was writing this.
ipc/interfaces.go
Outdated
WorkerEventNameStarted WorkerEventName = 4 | ||
|
||
// WorkerEventNameStopped is emitted when worker is stopped, | ||
// and it cannot process any message |
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.
// and it cannot process any message | |
// and it cannot process any message. |
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.
Good point. Is part of PR now.
) | ||
|
||
func (e WorkerEventName) String() string { | ||
switch e { | ||
case 1: | ||
case WorkerEventNameBegin: |
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.
Wow. We were not doing this before? Good find and refactor!
If I'm not mistaken, this PR fixes #135, correct? |
No, it does not. It could be used as a first step of getting correct list of workers, but you proposed better approach (easier to implement and more reliable). Your idea was something like this: "It will be easier to list all workers using interface You are welcome, Your External Memory ;-) |
* When worker is started, then it sends event "started" * It also sends event "stopped", when it is terminated and proces cannot handle message anymore * This functionality is IMHO important for developers of yggdrasil worker. When you develop new worker it is important to see that your worker "communication" with yggd during start. It is also decency to say something like "good bye" at the end. * Small refactoring of code (do not use numeric constant) * Updated doc strings * Extended documentation in com.redhat.Yggdrasil1.Worker1.xml according changes in code
e4e2a48
to
238e672
Compare
Do you mean that other workers could have some benefits from the fact that there is another buddy processing dispatched messages? Interesting idea, but I would implement that, when it will be really needed. We have many more urgent card in backlog. |
Oh yes, I remember that now. I just commented on #135 with that suggestion so that Future Link can be reminded as well. |
No, |
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.
LGTM
New signals are documented here: https://github.com/RedHatInsights/yggdrasil/pull/187/files#diff-ec9037acd507f9680945dd78261e1be61e857c68fa392d3bcba5e10332e0e2a9 Should these signals be documented elsewhere? So, do I understand you correctly that you want to transmit Lines 180 to 193 in cc61d41
|
Yes. That is the D-Bus API used by workers to communicate with their "dispatcher". That API could run on any bus: the system bus or a private session bus. The D-Bus interface specification I linked to is the "public" D-Bus API that is exported by
Given the way that code is written, they will be emitted, but their "Name" value might be unknown. We should also ensure that they're documented in the externally facing D-Bus API so that clients and code generation utilities can expect additional values beyond 1, 2 and 3. |
com.redhat.Yggdrasil1.Worker1.xml
according changes in code