You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Peter Bacsko (Jira)" <ji...@apache.org> on 2023/05/31 10:04:00 UTC

[jira] [Created] (YUNIKORN-1774) Event cache: misc cleanup

Peter Bacsko created YUNIKORN-1774:
--------------------------------------

             Summary: 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


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: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org