Skip to content
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

[YUNIKORN-1709] Add event streaming logic #533

Closed
wants to merge 9 commits into from

Conversation

pbacsko
Copy link
Contributor

@pbacsko pbacsko commented Apr 28, 2023

What is this PR for?

Core implementation of event streaming. Clients are updated real time on the REST interface. A persistent HTTP connection is maintained for them.

Consumers can request a new stream and receive core scheduler events immediately on a read-only channel. Slow consumers are detected by checking the number of elements in the channel buffer. If the channel buffer on the local side is full, we remove the consumer.

Explicit closure of the event stream is possible and consumers are expected to do it.

What type of PR is it?

  • - Bug Fix
  • - Improvement
  • - Feature
  • - Documentation
  • - Hot Fix
  • - Refactoring

Todos

  • - Task

What is the Jira issue?

https://issues.apache.org/jira/browse/YUNIKORN-1709

How should this be tested?

Screenshots (if appropriate)

Questions:

  • - The licenses files need update.
  • - There is breaking changes for older versions.
  • - It needs documentation.

@pbacsko pbacsko self-assigned this Apr 28, 2023
@pbacsko pbacsko marked this pull request as draft April 28, 2023 11:09
@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (2291cea) 78.01% compared to head (a3b132c) 78.19%.

❗ Current head a3b132c differs from pull request most recent head 948b275. Consider uploading reports for the commit 948b275 to get more accurate results

Files Patch % Lines
pkg/events/event_system.go 28.57% 10 Missing ⚠️
pkg/webservice/handlers.go 89.85% 6 Missing and 1 partial ⚠️
pkg/events/event_streaming.go 97.53% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #533      +/-   ##
==========================================
+ Coverage   78.01%   78.19%   +0.17%     
==========================================
  Files          82       83       +1     
  Lines       13378    13559     +181     
==========================================
+ Hits        10437    10602     +165     
- Misses       2615     2630      +15     
- Partials      326      327       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pbacsko pbacsko force-pushed the YUNIKORN-1709 branch 4 times, most recently from 854fad6 to 94dedb4 Compare April 28, 2023 19:08
@pbacsko pbacsko requested a review from wilfred-s May 1, 2023 15:01
@pbacsko pbacsko marked this pull request as ready for review May 1, 2023 15:01
pkg/events/event_streaming.go Outdated Show resolved Hide resolved
@pbacsko pbacsko changed the title [WIP] [YUNIKORN-1709] Store events separately for event streaming [YUNIKORN-1709] Store events separately for event streaming May 1, 2023
@pbacsko pbacsko force-pushed the YUNIKORN-1709 branch 4 times, most recently from f750b87 to af2b4e0 Compare May 1, 2023 17:20
@pbacsko pbacsko changed the title [YUNIKORN-1709] Store events separately for event streaming [YUNIKORN-1709] Add event streaming logic May 1, 2023
@pbacsko pbacsko marked this pull request as draft May 30, 2023 11:24
@pbacsko pbacsko force-pushed the YUNIKORN-1709 branch 2 times, most recently from d95930a to 8633a35 Compare August 25, 2023 16:00
@pbacsko pbacsko force-pushed the YUNIKORN-1709 branch 5 times, most recently from a50058e to 535b6f5 Compare November 7, 2023 11:43
@pbacsko pbacsko marked this pull request as ready for review November 7, 2023 12:54
@pbacsko
Copy link
Contributor Author

pbacsko commented Nov 22, 2023

Note: any timeout for the HTTP server can break the streaming (WriteTimeout for HTTP 1.1, ReadTimeout and IdleTimeout for HTTP 2.0). We either start a new server instance for the streaming or explicitly comment (or even test) that timeouts must not be used.

pkg/webservice/webservice.go Outdated Show resolved Hide resolved
pkg/webservice/handlers.go Show resolved Hide resolved
pkg/webservice/handlers.go Outdated Show resolved Hide resolved
pkg/scheduler/objects/common_test.go Outdated Show resolved Hide resolved
@pbacsko pbacsko force-pushed the YUNIKORN-1709 branch 3 times, most recently from 431c6ee to b9e11cd Compare November 30, 2023 10:56
Copy link
Contributor

@zhuqi-lucas zhuqi-lucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Left final minor comments!

@pbacsko
Copy link
Contributor Author

pbacsko commented Dec 8, 2023

ping @wilfred-s

Copy link
Contributor

@wilfred-s wilfred-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor changes to comments on exported functions can be fixed during the commit also

pkg/events/event_system.go Show resolved Hide resolved
pkg/events/event_system.go Show resolved Hide resolved
pkg/events/event_ringbuffer.go Show resolved Hide resolved
@pbacsko pbacsko closed this in 681a4cb Jan 24, 2024
consumer chan *si.EventRecord,
stop chan struct{},
name string,
count uint64) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this parameter is unused. Is it a potential bug or we can just remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a follow up jira to clean that up @pbacsko

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I actually have a list of necessary small code changes which are unrelated to each other, I'm adding this to the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants