Polochon-street / blissify-rs

bliss bindings for MPD.
30 stars 6 forks source link

Control number of processing jobs #27

Closed toofar closed 2 years ago

toofar commented 2 years ago

Something for the wishlist, it would be nice (for those with limited ram or who want to use their computer for other stuff at the same time) to be able to limit the amount of parallel processing jobs. It looks like in bliss it always spawns num_cpus threads currently.

For now I am limiting the amount of cores it can see with taskset, like taskset --cpu-list 1-10 blissify update /var/lib/music/ and that is working as expected.

Polochon-street commented 2 years ago

you're right, it does spawn as many threads as it can. It shouldn't be too difficult to make it an option.

Thanks for the feedback!

Polochon-street commented 2 years ago

I've bumped blissify, and this is now available as an option - you can use --number-cores n to customize the number of cores (as well as other goodies like config files)

Tell me if that solves it for you :)

toofar commented 2 years ago

Yeah that works for me thanks!

Although passing those values to init doesn't seem to take. I ended up modifying the config file directly. I didn't try passing stuff to update but since init starts doing processing anyway it needs to take there. Looks like it is trying to get the arguments from the subcommand form the top level argument matcher thing? This seems to work:

diff --git i/src/main.rs w/src/main.rs
index 89244d5fe722..dd93991c7b55 100644
--- i/src/main.rs
+++ w/src/main.rs
@@ -655,8 +655,8 @@ fn main() -> Result<()> {
             }
         }
     } else if let Some(sub_m) = matches.subcommand_matches("init") {
-        let database_path = matches.value_of("database-path").map(PathBuf::from);
-        let number_cores = matches
+        let database_path = sub_m.value_of("database-path").map(PathBuf::from);
+        let number_cores = sub_m
             .value_of("number-cores")
             .map(|x| x.parse::<NonZeroUsize>())
             .map_or(Ok(None), |r| r.map(Some))

Couple of other notes:

Polochon-street commented 2 years ago

all the issues should be addressed now - I've published a new version :)