diff --git a/bin/is b/bin/is index 84019a10bb3776fb80971a73c1d2f7d4922311ba..9f9cb770502cbf853bc1e8e11b0831615bb95727 100755 --- a/bin/is +++ b/bin/is @@ -429,8 +429,10 @@ def arg_parser_init(): help="dot not display colored output") parser.add_argument("--nice", type=int, default=0, help="nice of the process") - parser.add_argument("--ionice", choices=["none","rt", "be","idle"], + parser.add_argument("--ionice-class", choices=["none","rt", "be","idle"], help="ionice class of the process (default: none)") + parser.add_argument("--ionice-level", type=int, default=None, + help="ionice class level of the process") # create a subparser for commands subparser = parser.add_subparsers() # add command parser @@ -667,22 +669,22 @@ def main(): if installsystems.verbosity < 2: warnings.filterwarnings("ignore") # nice and ionice process - if options.nice is not None or options.ionice is not None: + if options.nice is not None or options.ionice_class is not None: proc = psutil.Process(os.getpid()) if options.nice is not None: try: proc.nice = options.nice except Exception: warn("Unable to nice process to %s" % options.nice) - if options.ionice is not None: + if options.ionice_class is not None: try: ioclassmap = { "none": psutil.IOPRIO_CLASS_NONE, "rt": psutil.IOPRIO_CLASS_RT, "be": psutil.IOPRIO_CLASS_BE, "idle": psutil.IOPRIO_CLASS_IDLE} - proc.set_ionice(ioclassmap[options.ionice]) + proc.set_ionice(ioclassmap[options.ionice_class], options.ionice_level) except Exception: - warn("Unable to ionice process to %s" % options.ionice) + warn("Unable to ionice process to %s" % options.ionice_class) # except for install command we parse all args! # install command is responsible of parsing if options.func is not c_install: diff --git a/installsystems/config.py b/installsystems/config.py index 971576b287bff595503c3fdb4bda85138d6ec308..0babb4cc115307b36c50dab71c286142e8134a78 100644 --- a/installsystems/config.py +++ b/installsystems/config.py @@ -62,7 +62,8 @@ class MainConfigFile(ConfigFile): "repo_filter": str, "repo_config": str, "nice": int, - "ionice": ["none", "rt", "be", "idle"] + "ionice_class": ["none", "rt", "be", "idle"], + "ionice_level": int } def __init__(self, filename, prefix=os.path.basename(sys.argv[0])): self.prefix = prefix diff --git a/samples/installsystems.conf b/samples/installsystems.conf index 8e8cd902b99a1e9bb64005b48415aadc00273aac..f2cd34d6abebc2a2bf2768c9a2343aa557908a4f 100644 --- a/samples/installsystems.conf +++ b/samples/installsystems.conf @@ -5,11 +5,14 @@ # Set verbosity (0: quiet, 1: normal, 2: debug) #verbosity = 2 -# Set nice process value +# Set nice process value (see nice (1)) #nice = 0 -# Set ionice class -#ionice = idle +# Set ionice class (see ionice (1)) +#ionice_class = idle + +# Set ionice class data level (see ionice (1)) +#ionice_level = 0 # define a custom cache directory #cache = /tmp/sex