shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
848 stars 62 forks source link

Fatal mistake: rush may break orders and cause line broken #7

Closed bioinformatist closed 6 years ago

bioinformatist commented 6 years ago

When use rush to deal with SAM file, I find: The -k parameter not works, also original-complete line may broken. To reproduce, you may run command below with attached files example.tar.gz:

head -n7 times | cut -f1 | rush "grep \"{}\" secondary_mapped.sam >> most.sam" -k

When parameter --dry-run is given, I get commands listed as below : image See the order? As same as file times used in rush: image But the order comes wrong

when I remove --dry-run: image Also, lines may be broken by rush: image

But when I use only one thread (-j 1) at a time, everything is OK.

head -n7 times | cut -f1 | rush "grep \"{}\" secondary_mapped.sam >> most.sam" -k -j1
shenwei356 commented 6 years ago

Well, It's not a bug of rush.

You should not simultaneously append data to one file.

Your command:

head -n7 times | cut -f1 | rush "grep \"{}\" secondary_mapped.sam >> most.sam" -k

The right command:

head -n7 times | cut -f1 | rush "grep \"{}\" secondary_mapped.sam" -k >  most.sam
likelet commented 6 years ago

wtf