nowol79 / data-processing

data processing tricks & tip
0 stars 0 forks source link

GNU parallel 이용하기 #1

Open nowol79 opened 6 years ago

nowol79 commented 6 years ago

[고민사항]

찾다가 GNU parallel 발견

일단 원하는 job를 command.list로 뽑고 이를 parallel로 job 설정을 해서 돌림

이렇게 만개 이상의 파일을 remote 로 전달하는데 한 번 rsync 하는데 1분 정도 소요됨..

이를 무작정 process를 여러개 만들자니 귀찮고..

아래와 같이 parallel를 활용해 해결

$ cat command.list | parallel --eta --jobs 10 --load 60% --noswap '{}'

--eta : estimated time remaining to run all jobs. --jobs : The number of commands to run at the same time --load 80% : The maximum CPU load at which new jobs will not be started. --noswap: New jobs won't be started if there is both swap-in and swap-out activity.

[결론] 반복적인 작업을 멀티로 안전하게 진행하고 싶은 경우 사용하면 좋을 듯!