-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Add -lp
/--low-priority
/KOMETA_LOW_PRIORITY
to allow Kometa to run at lower/higher priorities
#2397
base: nightly
Are you sure you want to change the base?
Conversation
I would greatly appreciate any testing on this, particularly the Docker image is |
@YozoraXCII just carried out a visual code-review. I can’t see Originally I only added lowering the priority; otherwise in Docker you have to add Should the definition be changed to reflect it is now changing Kometa’s run process priority, not just lowering/nice-ing the process. |
Let me take this away and think about how to handle it. I may need to reduce the scope if we're going to potentially run into privilege issues. |
I wrote a long reply about this. However I a got BSOD on my Windows machine before hitting comment :( |
In the previous PR we discussed this, there was a question about adding the ability to also increase the process priority. I was reluctant for a few reasons:
Escalate container privileges (--privileged) Escalate container privilegesThe
In other words, the container can then do almost everything that the host can do. This flag exists to allow special use-cases, like running Docker within Docker.
Win32 API Priority Classes
|
Not ignoring this, just haven't had the headspace to read and contemplate all this - it's a bit above my knowledge level if I'm honest lol. |
There's zero urgency! No worries, and no stress! :) TLDR; don't raise process priority above normal! :) In Windows (the Win32 API) |
kometa.py
Outdated
def low_priority(niceness): | ||
"""Set the priority of the process based on the niceness level.""" | ||
|
||
isWindows = platform.system() == "Windows" |
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.
I'd changed this to:
isWindows = os.name == 'nt'
os.name
will only return one of ['posix', 'nt', 'java']
platform.system()
returns many aliases and the platform library is for detailed system information.
https://docs.python.org/3/library/os.html#os.name
os.name
The name of the operating system dependent module imported. The following names have currently been registered: 'posix', 'nt', 'java'.
I added a comment on the isWindows code check; copied here for visibility: I'd changed this to:
https://docs.python.org/3/library/os.html#os.name
|
7213650
to
fe6e080
Compare
@planetrocky would you mind reviewing the most recent changes and doing some tests? |
-pr
/--priority
/KOMETA_PRIORITY
to allow Kometa to run at lower/higher priorities-lp
/--low-priority
/KOMETA_LOW_PRIORITY
to allow Kometa to run at lower/higher priorities
Description
Credits to @planetrocky for the initial Pull Request.
This change allows the user to specify the priority that Kometa run at on Windows/Linux/Mac (and should work in Docker too).
The options available are:
25: Below Normal
50: Normal (default)
75: Above Normal
90: High
100: Realtime
Issues Fixed or Closed
Closes #2304 (supersedes)
Type of Change
Checklist