mmstick/parallel

Name improvement

ole-tange opened this issue · 6 comments

Hi Michael

I have looked at rust-parallel. I am impressed with the speed and see there is a niche which is well filled by rust-parallel that GNU Parallel is likely never to fill.

However, calling the program 'parallel' may lead to problems you are not aware of. GNU Parallel was started before there was a UNIX tool called 'parallel'. Unfortunately another tool was later distributed as 'parallel', and that has lead to confusions that haunts us even today. The other tool was of course incompatible with GNU Parallel, but people thought they had installed GNU Parallel and were frustrated when the examples did not work. You can read more about that situation on https://www.gnu.org/software/parallel/history.html

The problem would be smaller if rust-parallel was 100% option compatible with GNU Parallel, and that it could serve as a drop-in replacement, but already now I can see rust-parallel does something different when running:

parallel echo ::: a b c :::+ 1 2 3 ::: d e f :::+ 4 5 6
parallel -n 2 echo ::: a b c d
parallel --shellquote ::: '*#"'

and I find it highly improbable that you will ever implement the '{= perl expression =}' replacement string:

parallel echo '{= $_ > 2 ? $_=">2" : $_-- =}' ::: 1 2 3 4

Walking through GNU Parallel's tutorial with rust-parallel is also impossible.

On top of this the name clash makes it hard to have both tools installed: Maybe some users like the short startup time that rust-parallel provides for some tasks, while they like the flexibilty of GNU Parallel for others? By using the same name you are making it harder for them to use both GNU Parallel and rust-parallel.

Because of these issues I will be really happy if you change the name 'parallel', as I think in the long term you will avoid creating problems for users where none need be.

I understand you are making the tool to show off what you can do with Rust. Maybe you could show Rust directly in the name? Rust-parallel, rustpar, pa(r)rust?

Do not get me wrong. I am flattered by the imitation and I like competition: A lot of the ideas in GNU Parallel came from other tools, and I hope that rust-parallel will come up with new game-changing ideas, as that will benefit society.

Basically, anyone's free to choose a name of their choosing for the resulting binary, but for simplicity on the command line, parallel is easy to remember and type. If they want to have both binaries installed in the same directory, then they're free to rename one or the other.

In any case, besides the perl expressions, any significant difference between GNU Parallel and this MIT/Rust implementation at this point should be considered a bug or unimplemented feature. Although I have my own ideas for tackling distributed computing via a client/server model that doesn't involve SSH, when I get to that point. I'll just enable it so that parallel can run as a daemon, perhaps as a separate binary.

I've fixed the issue with :::+ and ::::+ in the last commit, so now both of these commands will produce the same outputs

parallel echo ::: a b c :::+ 1 2 3 ::: d e f :::+ 4 5 6

I say it produces the same outputs, but they are in a different order:

GNU

a 1 d 4
a 1 e 5
a 1 f 6
b 2 e 5
b 2 f 6
b 2 d 4
c 3 d 4
c 3 e 5
c 3 f 6

Rust/MIT

a 1 d 4
a 1 e 5
a 1 f 6
b 2 d 4
b 2 e 5
b 2 f 6
c 3 d 4
c 3 e 5
c 3 f 6

The latest commit that I have just pushed has implemented support for maximum arguments, so this will now work exactly the same:

parallel -n 2 echo ::: a b c d

a client/server model that doesn't involve SSH

Care to elaborate? This sounds dangerous at first glance.

@ConnyOnny I need a solution that will work on all platforms, and Windows does not support SSH. I have nothing concrete to say about what I will implement, but security will naturally be taken into consideration. I can look into Rust-based encryption libraries like rustls when the time comes, so that I may retain a fully static binary that works on all platforms.

Thank you for the reply. I recognize other things are a higher priority for this project as of now, but just so that I don't forget to tell you when the time is ripe: You can have SSH support on Windows if you are willing to include it in the binary. For example this crate looks like it might run on Windows: https://crates.io/crates/thrussh
If you do crypto, always take the time to find a library that does as much as possible for you. Stay safe and keep it up 👍