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

Enhance Concurrency and Cancellation Handling in Job Execution #20

Closed
wants to merge 6 commits into from

Conversation

falvarez1
Copy link
Member

Description:

This Pull Request introduces significant enhancements to how concurrency and cancellation are managed within job executions. Key changes include:

  • Asynchronous Execution Enhancements: All job runs are now fully asynchronous, ensuring that operations are non-blocking and responsive throughout their execution paths.
  • Improved Cancellation Support: Enhancements to cancellation token usage allow for more responsive cancellation of ongoing jobs. Cancellation checks are integrated more deeply into the job execution logic, allowing for quicker termination of jobs in response to cancellation requests.
  • Concurrency Control with Priority Queue: Implemented a priority queue-based concurrency control mechanism. This allows multiple job instances to run in parallel while respecting priority constraints.

These changes aim to make the job execution process more efficient, responsive, and reliable, particularly under high load and in complex scheduling scenarios.

Future work, the concurrency control responsibilities still need to be moved into the JobExecutor , this shift will centralize how parallel executions are managed, simplifying maintenance and extending capabilities.

A new `TestCancellationJob` class has been added to simulate a long-running job and handle job cancellation.
Everything was made to support async structures to better support error handling and cancellation support.
Added preliminary parallel execution support.
@falvarez1
Copy link
Member Author

falvarez1 commented Apr 16, 2024

@linkdotnet how do you want contributions to be made? I see code being pushed directly to main, do you have a preference?

@linkdotnet
Copy link
Member

@falvarez1 Thanks for providing that quality PR!

As I did mostly work alone I directly merged to main. The general rule of thumb is that if it isn't a breaking change it goes to main otherwise to v2, v3 and so on.

I do see some overlap with #21 - is this PR still "valid"? Or does it make sense to review and merge #21 first and see which bits are still missing?

@falvarez1
Copy link
Member Author

Since #21 piggybacks on this one I suppose this one is unnecessary. I probably should have worked on the same branch but wasn't sure about your contributions preferences.

@falvarez1
Copy link
Member Author

One thing to note, the Tests are broken at the moment. I didn't spend any time fixing them because I just wanted to have you review the design changes first.

@linkdotnet
Copy link
Member

That is fine - they can be fixed afterward.

@falvarez1
Copy link
Member Author

Closing this PR as it is superceded by #21.

@falvarez1 falvarez1 closed this Apr 18, 2024
@falvarez1 falvarez1 deleted the scheduler-improvements branch May 19, 2024 17:22
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.

2 participants