GNU parallel call shell function make got wrong











up vote
0
down vote

favorite












In my real project ,something like the code blew, read servel modules from file,like a1 a2 a3,a2 depends a1 and a3 depends a2.In another function like b1 b2 b3,but nothing to do with a1 a2 a3,so they can be parallel.



#!/bin/bash



dir=/root/
code_dir="code"
doubleit()
{
local transfer_dir=$1
local moudles=`cat ${code_dir}/depend/$2`

for module in $ moudles;do
${code_dir}/build/build_module.sh $transfer_dir $module
transfer $transfer_dir
done
}


export -f doubleit
export -f transfer

export code_dir

parallel doubleit ::: $dir ::: $A $B


If in function douleit,I called example.sh,do I need to export all the function in example.sh?



I got a wrong msg,can't figure out why.



Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
upgrade_col.cpp: In function ‘void increase_update_count(unsigned int)’:
upgrade_col.cpp:170:33: warning: narrowing conversion of ‘uptime’ from ‘time_t {aka long int}’ to ‘unsigned int’ inside { } is ill-formed in C++11 [-Wnarrowing]
update_ctx_t uctx = {1, uptime};
^
Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
parallel: This job failed:
build_packages_parallel /root/v2.5/code/build/eps_cloud basis


when I run the jobs manually,echo $? just output 0,how does the parallel judge if the job is failed.I am very glad if there is any suggestion although it is closely related to my projects.



another question,if I run the function like this



doubleit arg1 &
doubleit arg2 &
wait


does this use the differnt cpu cores to speed up?
if one job failed,how to exit the shell function and killed all the bg task,I know $!,and wait the array,but not work.










share|improve this question
























  • See if you can make an MCVE stackoverflow.com/help/mcve
    – Ole Tange
    Nov 18 at 9:57















up vote
0
down vote

favorite












In my real project ,something like the code blew, read servel modules from file,like a1 a2 a3,a2 depends a1 and a3 depends a2.In another function like b1 b2 b3,but nothing to do with a1 a2 a3,so they can be parallel.



#!/bin/bash



dir=/root/
code_dir="code"
doubleit()
{
local transfer_dir=$1
local moudles=`cat ${code_dir}/depend/$2`

for module in $ moudles;do
${code_dir}/build/build_module.sh $transfer_dir $module
transfer $transfer_dir
done
}


export -f doubleit
export -f transfer

export code_dir

parallel doubleit ::: $dir ::: $A $B


If in function douleit,I called example.sh,do I need to export all the function in example.sh?



I got a wrong msg,can't figure out why.



Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
upgrade_col.cpp: In function ‘void increase_update_count(unsigned int)’:
upgrade_col.cpp:170:33: warning: narrowing conversion of ‘uptime’ from ‘time_t {aka long int}’ to ‘unsigned int’ inside { } is ill-formed in C++11 [-Wnarrowing]
update_ctx_t uctx = {1, uptime};
^
Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
parallel: This job failed:
build_packages_parallel /root/v2.5/code/build/eps_cloud basis


when I run the jobs manually,echo $? just output 0,how does the parallel judge if the job is failed.I am very glad if there is any suggestion although it is closely related to my projects.



another question,if I run the function like this



doubleit arg1 &
doubleit arg2 &
wait


does this use the differnt cpu cores to speed up?
if one job failed,how to exit the shell function and killed all the bg task,I know $!,and wait the array,but not work.










share|improve this question
























  • See if you can make an MCVE stackoverflow.com/help/mcve
    – Ole Tange
    Nov 18 at 9:57













up vote
0
down vote

favorite









up vote
0
down vote

favorite











In my real project ,something like the code blew, read servel modules from file,like a1 a2 a3,a2 depends a1 and a3 depends a2.In another function like b1 b2 b3,but nothing to do with a1 a2 a3,so they can be parallel.



#!/bin/bash



dir=/root/
code_dir="code"
doubleit()
{
local transfer_dir=$1
local moudles=`cat ${code_dir}/depend/$2`

for module in $ moudles;do
${code_dir}/build/build_module.sh $transfer_dir $module
transfer $transfer_dir
done
}


export -f doubleit
export -f transfer

export code_dir

parallel doubleit ::: $dir ::: $A $B


If in function douleit,I called example.sh,do I need to export all the function in example.sh?



I got a wrong msg,can't figure out why.



Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
upgrade_col.cpp: In function ‘void increase_update_count(unsigned int)’:
upgrade_col.cpp:170:33: warning: narrowing conversion of ‘uptime’ from ‘time_t {aka long int}’ to ‘unsigned int’ inside { } is ill-formed in C++11 [-Wnarrowing]
update_ctx_t uctx = {1, uptime};
^
Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
parallel: This job failed:
build_packages_parallel /root/v2.5/code/build/eps_cloud basis


when I run the jobs manually,echo $? just output 0,how does the parallel judge if the job is failed.I am very glad if there is any suggestion although it is closely related to my projects.



another question,if I run the function like this



doubleit arg1 &
doubleit arg2 &
wait


does this use the differnt cpu cores to speed up?
if one job failed,how to exit the shell function and killed all the bg task,I know $!,and wait the array,but not work.










share|improve this question















In my real project ,something like the code blew, read servel modules from file,like a1 a2 a3,a2 depends a1 and a3 depends a2.In another function like b1 b2 b3,but nothing to do with a1 a2 a3,so they can be parallel.



#!/bin/bash



dir=/root/
code_dir="code"
doubleit()
{
local transfer_dir=$1
local moudles=`cat ${code_dir}/depend/$2`

for module in $ moudles;do
${code_dir}/build/build_module.sh $transfer_dir $module
transfer $transfer_dir
done
}


export -f doubleit
export -f transfer

export code_dir

parallel doubleit ::: $dir ::: $A $B


If in function douleit,I called example.sh,do I need to export all the function in example.sh?



I got a wrong msg,can't figure out why.



Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
upgrade_col.cpp: In function ‘void increase_update_count(unsigned int)’:
upgrade_col.cpp:170:33: warning: narrowing conversion of ‘uptime’ from ‘time_t {aka long int}’ to ‘unsigned int’ inside { } is ill-formed in C++11 [-Wnarrowing]
update_ctx_t uctx = {1, uptime};
^
Makefile:18: warning: overriding recipe for target `install'
common.mk:100: warning: ignoring old recipe for target `install'
parallel: This job failed:
build_packages_parallel /root/v2.5/code/build/eps_cloud basis


when I run the jobs manually,echo $? just output 0,how does the parallel judge if the job is failed.I am very glad if there is any suggestion although it is closely related to my projects.



another question,if I run the function like this



doubleit arg1 &
doubleit arg2 &
wait


does this use the differnt cpu cores to speed up?
if one job failed,how to exit the shell function and killed all the bg task,I know $!,and wait the array,but not work.







linux shell parallel-processing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 8:48

























asked Nov 18 at 4:11









52coder

765




765












  • See if you can make an MCVE stackoverflow.com/help/mcve
    – Ole Tange
    Nov 18 at 9:57


















  • See if you can make an MCVE stackoverflow.com/help/mcve
    – Ole Tange
    Nov 18 at 9:57
















See if you can make an MCVE stackoverflow.com/help/mcve
– Ole Tange
Nov 18 at 9:57




See if you can make an MCVE stackoverflow.com/help/mcve
– Ole Tange
Nov 18 at 9:57

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357820%2fgnu-parallel-call-shell-function-make-got-wrong%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357820%2fgnu-parallel-call-shell-function-make-got-wrong%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin