[
https://issues.apache.org/jira/browse/YUNIKORN-1774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Peter Bacsko updated YUNIKORN-1774:
-----------------------------------
Description:
There are a couple of things that could be re-written or modified in the
current event handling code:
* The name {{EventCache}} is a bit of a misnomer. This is the entry point of
the whole event mechanism, not a cache. Suggested new name is {{EventSystem.}}
* The cache and publisher are created separately. The publisher does not work
without the remaining infrastructure. They should be handled together. In a
similar vein, starting the publisher with a separate {{start()}} method should
be hidden.
* Get rid of extra interfaces: during the design phase, the intention was
having multiple implementations. However, we still have only one
({{{}shimPublisher{}}}, {{{}defaultEventStore{}}}). As long as we don't have
mocks and multiple implementations, let's remove it to reduce code.
* We need to guard against the condition if the event cache is "nil"
(disabled). But we end up having code like:
{noformat}
eventCache := events.GetEventCache(); eventCache != nil {
... send event ...
}
{noformat}
An extra layer eg. {{ApplicationEvents.sendEventNotFit()}} enhances readability
and usability.
* Nit: use {{atomic.Bool}} instead of {{atomic.Value}} in
{{{}shimPublisher{}}}.
was:
There are a couple of things that could be re-written or modified in the
current event handling code:
* The name {{EventCache}} is a bit of a misnomer. This is the entry point of
the whole event mechanism, not a cache. Suggested new name is {{EventSystem}}
* The cache and publisher are created separately. The publisher does not work
without the remaining infrastructure. They should be handled together. In a
similar vein, starting the publisher with a separate {{start()}} method should
be hidden.
* Get rid of extra interfaces: during the design phase, the intention was
having multiple implementations. However, we still have only one
({{{}shimPublisher{}}}, {{{}defaultEventStore{}}}). As long as we don't have
mocks and multiple implementations, let's remove it to reduce code.
* We need to guard against the condition if the event cache is "nil"
(disabled). But we end up having code like:
{noformat}
eventCache := events.GetEventCache(); eventCache != nil {
... send event ...
}
{noformat}
An extra layer eg. {{ApplicationEvents.sendEventNotFit()}} enhances readability
and usability.
* Nit: use {{atomic.Bool}} instead of {{atomic.Value}} in
{{{}shimPublisher{}}}.
> Event cache: misc cleanup
> -------------------------
>
> Key: YUNIKORN-1774
> URL: https://issues.apache.org/jira/browse/YUNIKORN-1774
> Project: Apache YuniKorn
> Issue Type: Sub-task
> Components: core - common, core - scheduler
> Reporter: Peter Bacsko
> Assignee: Peter Bacsko
> Priority: Major
>
> There are a couple of things that could be re-written or modified in the
> current event handling code:
> * The name {{EventCache}} is a bit of a misnomer. This is the entry point of
> the whole event mechanism, not a cache. Suggested new name is {{EventSystem.}}
> * The cache and publisher are created separately. The publisher does not
> work without the remaining infrastructure. They should be handled together.
> In a similar vein, starting the publisher with a separate {{start()}} method
> should be hidden.
> * Get rid of extra interfaces: during the design phase, the intention was
> having multiple implementations. However, we still have only one
> ({{{}shimPublisher{}}}, {{{}defaultEventStore{}}}). As long as we don't have
> mocks and multiple implementations, let's remove it to reduce code.
> * We need to guard against the condition if the event cache is "nil"
> (disabled). But we end up having code like:
> {noformat}
> eventCache := events.GetEventCache(); eventCache != nil {
> ... send event ...
> }
> {noformat}
> An extra layer eg. {{ApplicationEvents.sendEventNotFit()}} enhances
> readability and usability.
> * Nit: use {{atomic.Bool}} instead of {{atomic.Value}} in
> {{{}shimPublisher{}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]