Dear Officer,
First of all, thank you for making such great tool for us.
I have some troubles manipulating the stdout and stderr of parallel jobs. I am running GNU parallel on CentOS7 and the version number of parallel is GNU parallel 20181222.
My ultimate purpose is to
output stdout and stderr(combining stdout and stderr together) of each job to a specified log file in a real-time way.
For that I built a test script like this:
‘''
function tstp(){
date
}
function haha(){
echo $(tstp): haha
}
function hoho(){
echo $(tstp): hoho
}
function hehe(){
echo $(tstp): hehe
}
function para_later(){
if [[ $1 == "hohe" ]]; then hoho && hehe; fi
if [[ $1 == "haha" ]]; then haha; fi
}
function combine_func(){
hoho && hehe
}
export -f haha
export -f hoho
export -f hehe
export -f para_later
export -f combine_func
export -f tstp
# parallel --dryrun --link --env _ --progress --keep-order -d ,,, --jobs 2 para_later {1} '>' {2}.log '2>&1' ::: haha,,,hohe ::: $(pwd)/haha,,,$(pwd)/hohe
parallel --dryrun --link --env _ --progress --keep-order -d ,,, --jobs 2 para_later '2>&1' ::: haha,,,hohe
# parallel --dryrun --link --results $(pwd) --env _ --progress --keep-order -d ,,, --jobs 2 para_later ::: haha,,,hohe
# parallel --dryrun --env _ --keep-order -d ,,, --jobs 2 ::: haha,,,combine_func
‘''
As you can see that I tried a log of command to run parallel (including those commented out ones) and none of them works. I even use —results argument yet the stdout file does not exist (As you can see from the screenshot below)
I don’t understand and it seems that the functions being called are not running properly. From the no-commented out command I got:
From the last commented out command I got:
From the first commented out command I got:
I don’t know what went wrong. Could you pls help me solve the issue the reach my goal of logging or correctly import functions?
Thank you!