-
Notifications
You must be signed in to change notification settings - Fork 0
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 license controller + process termination support #239
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #239 +/- ##
==========================================
+ Coverage 71.83% 72.87% +1.04%
==========================================
Files 33 35 +2
Lines 3554 3742 +188
Branches 422 437 +15
==========================================
+ Hits 2553 2727 +174
- Misses 844 854 +10
- Partials 157 161 +4
🚀 New features to boost your workflow:
|
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 better than before
} | ||
} | ||
if (!found) { | ||
throw new Exception("No processes found to kill for the current user"); |
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.
Refactor this into a separate unsafe method
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.
can be done in a separate pr as well
{ | ||
foreach (ManagementObject process in results) | ||
{ | ||
try |
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.
can be outside the for loop as well
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.
can be done in a separate pr as well
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.
NT - just leaving this here to make the PR disappear from my risk review dashboard.
Dag is doing the risk review.
@@ -23,8 +23,10 @@ | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Cognite.ExtractorUtils" Version="1.29.0" /> | |||
<PackageReference Include="Microsoft.Bcl.TimeProvider" Version="10.0.0-preview.1.25080.5" /> |
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.
Why do we use the preview version?
@@ -175,7 +175,8 @@ public string GetSimulatorVersion() | |||
public Task<Dictionary<string, SimulatorValueItem>> RunSimulation( | |||
SampleModelFilestate modelState, | |||
SimulatorRoutineRevision routineRevision, | |||
Dictionary<string, SimulatorValueItem> inputData | |||
Dictionary<string, SimulatorValueItem> inputData, | |||
CancellationToken _token |
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.
Why do we underscore the parameter name?
Why is this PR needed?
This package (
dotnet-simulator-utils
) is used by the PROSPER connector to integrate the PROSPER simulator with CDF. Recently we were having issues with a customer where the PROSPER connector would not be able to run simulations (at random) because the connector was unable to acquire a license for starting the simulator, we came up with an approach where the connector would acquire a license at startup and keep holding on to it for a user defined period of time. We also noticed that occasionally when we shut down the PROSPER simulator, the license would still keep on being consumed unless the simulator process was killed.This PR adds
LicenseController
: To help PROSPER (or any other connector) keep track of holding the license and releasing it after a timeoutProcessUtils
: To help PROSPER (or any other connector) find processes belonging to the current user and terminating them. This part also caused us to modify our Github action, since the tests for this only run on Windows.This PR removes: