gnu parallel exit process with timeoutUsing GNU Parallel With SplitWhen GNU parallel exit,my program also failConcurrency problems with GNU parallelgnu parallel with no argument scriptBASH: parallel runGNU Parallel to process multiple files in parallel in Unix with bashKeeping dirs in order with GNU ParallelGNU parallel with for loop?Copying & Renaming Files with GNU Parallelgnu parallel with bash array

Multi tool use
Multi tool use

Return the Closest Prime Number

Would a high gravity rocky planet be guaranteed to have an atmosphere?

Is expanding the research of a group into machine learning as a PhD student risky?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

Gears on left are inverse to gears on right?

Are student evaluations of teaching assistants read by others in the faculty?

Failed to fetch jessie backports repository

Opposite of a diet

Do sorcerers' Subtle Spells require a skill check to be unseen?

Is the destination of a commercial flight important for the pilot?

Go Pregnant or Go Home

How to write papers efficiently when English isn't my first language?

Do the temporary hit points from the Battlerager barbarian's Reckless Abandon stack if I make multiple attacks on my turn?

Two monoidal structures and copowering

Why not increase contact surface when reentering the atmosphere?

Crossing the line between justified force and brutality

Is there a korbon needed for conversion?

Trouble understanding the speech of overseas colleagues

Unreliable Magic - Is it worth it?

Applicability of Single Responsibility Principle

What is the intuitive meaning of having a linear relationship between the logs of two variables?

How to run a prison with the smallest amount of guards?

What is the difference between "behavior" and "behaviour"?



gnu parallel exit process with timeout


Using GNU Parallel With SplitWhen GNU parallel exit,my program also failConcurrency problems with GNU parallelgnu parallel with no argument scriptBASH: parallel runGNU Parallel to process multiple files in parallel in Unix with bashKeeping dirs in order with GNU ParallelGNU parallel with for loop?Copying & Renaming Files with GNU Parallelgnu parallel with bash array













1















Is it possible to abort process for gnu parallel process if it exceeds an estimated runtime? For example, I have a handler for recon-all processing:



while [ -n "$ids[0]" ] ; do
printf 'Processing ID: %sn' "$ids[@]" >&2

/usr/bin/time -f "$timefmt"
printf '%sn' "$ids[@]" | parallel --jobs 0 recon-all -s . -all -
qcache -parallel -openmp 8

n=$(( n + 1 ))
ids=( "$all_ids[@]:n*4:4" ) # pick out the next eight IDs
done


and some patients in recon-all process inside parallel couldn't be completed for some reasons (could run several days, which abnormal).
Could I limit the runtime inside parallel for 9 hours, so the command will run another group in the cycle?










share|improve this question
























  • Not really sure why you want to run in batches of 8. Why not just use -j8 and run all ids with 8 running constantly?

    – Ole Tange
    13 hours ago
















1















Is it possible to abort process for gnu parallel process if it exceeds an estimated runtime? For example, I have a handler for recon-all processing:



while [ -n "$ids[0]" ] ; do
printf 'Processing ID: %sn' "$ids[@]" >&2

/usr/bin/time -f "$timefmt"
printf '%sn' "$ids[@]" | parallel --jobs 0 recon-all -s . -all -
qcache -parallel -openmp 8

n=$(( n + 1 ))
ids=( "$all_ids[@]:n*4:4" ) # pick out the next eight IDs
done


and some patients in recon-all process inside parallel couldn't be completed for some reasons (could run several days, which abnormal).
Could I limit the runtime inside parallel for 9 hours, so the command will run another group in the cycle?










share|improve this question
























  • Not really sure why you want to run in batches of 8. Why not just use -j8 and run all ids with 8 running constantly?

    – Ole Tange
    13 hours ago














1












1








1








Is it possible to abort process for gnu parallel process if it exceeds an estimated runtime? For example, I have a handler for recon-all processing:



while [ -n "$ids[0]" ] ; do
printf 'Processing ID: %sn' "$ids[@]" >&2

/usr/bin/time -f "$timefmt"
printf '%sn' "$ids[@]" | parallel --jobs 0 recon-all -s . -all -
qcache -parallel -openmp 8

n=$(( n + 1 ))
ids=( "$all_ids[@]:n*4:4" ) # pick out the next eight IDs
done


and some patients in recon-all process inside parallel couldn't be completed for some reasons (could run several days, which abnormal).
Could I limit the runtime inside parallel for 9 hours, so the command will run another group in the cycle?










share|improve this question
















Is it possible to abort process for gnu parallel process if it exceeds an estimated runtime? For example, I have a handler for recon-all processing:



while [ -n "$ids[0]" ] ; do
printf 'Processing ID: %sn' "$ids[@]" >&2

/usr/bin/time -f "$timefmt"
printf '%sn' "$ids[@]" | parallel --jobs 0 recon-all -s . -all -
qcache -parallel -openmp 8

n=$(( n + 1 ))
ids=( "$all_ids[@]:n*4:4" ) # pick out the next eight IDs
done


and some patients in recon-all process inside parallel couldn't be completed for some reasons (could run several days, which abnormal).
Could I limit the runtime inside parallel for 9 hours, so the command will run another group in the cycle?







bash gnu-parallel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









Jeff Schaller

44k1161142




44k1161142










asked yesterday









RelyativistRelyativist

296




296












  • Not really sure why you want to run in batches of 8. Why not just use -j8 and run all ids with 8 running constantly?

    – Ole Tange
    13 hours ago


















  • Not really sure why you want to run in batches of 8. Why not just use -j8 and run all ids with 8 running constantly?

    – Ole Tange
    13 hours ago

















Not really sure why you want to run in batches of 8. Why not just use -j8 and run all ids with 8 running constantly?

– Ole Tange
13 hours ago






Not really sure why you want to run in batches of 8. Why not just use -j8 and run all ids with 8 running constantly?

– Ole Tange
13 hours ago











1 Answer
1






active

oldest

votes


















0














You are looking for --timeout.



You can do --timeout 9h or you can do --timeout 1000%. The last will measure how long the median time is for a job to succeed, and given the median it will compute a timeout that is 1000% of the median run time.



The neat thing about using a percentage is that if the compute program gets faster or slower for the normal case, you will not need to change the timeout.



See it in action:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3
# Compute program gets 10 times faster
parallel --timeout 300% 'sleep =$_ /= 10 =; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3


The median (not average) runtime is measured as the median of the succesfully completed jobs (though minimum 3). So if you have 8 jobs with job 5 being infinite, it will get killed when the runtime hits the percentage of the median timeout:



parallel --timeout 300% 'sleep ; echo ' ::: 1 2 1 2 100 2 1 2


This also works if the first job is the one that is stuck:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 1 2 1 2 1 2


The only situation it does not work is if all jobslots are stuck on their first job:



parallel -j4 --timeout 300% 'sleep ; echo ' ::: 100 100 100 100 1 2 1 2





share|improve this answer

























  • The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

    – Relyativist
    13 hours ago











  • In most cases it can. See edit.

    – Ole Tange
    13 hours ago











  • gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

    – Relyativist
    11 hours ago











  • Of course it works with 9h.

    – Ole Tange
    7 hours ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f508693%2fgnu-parallel-exit-process-with-timeout%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You are looking for --timeout.



You can do --timeout 9h or you can do --timeout 1000%. The last will measure how long the median time is for a job to succeed, and given the median it will compute a timeout that is 1000% of the median run time.



The neat thing about using a percentage is that if the compute program gets faster or slower for the normal case, you will not need to change the timeout.



See it in action:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3
# Compute program gets 10 times faster
parallel --timeout 300% 'sleep =$_ /= 10 =; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3


The median (not average) runtime is measured as the median of the succesfully completed jobs (though minimum 3). So if you have 8 jobs with job 5 being infinite, it will get killed when the runtime hits the percentage of the median timeout:



parallel --timeout 300% 'sleep ; echo ' ::: 1 2 1 2 100 2 1 2


This also works if the first job is the one that is stuck:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 1 2 1 2 1 2


The only situation it does not work is if all jobslots are stuck on their first job:



parallel -j4 --timeout 300% 'sleep ; echo ' ::: 100 100 100 100 1 2 1 2





share|improve this answer

























  • The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

    – Relyativist
    13 hours ago











  • In most cases it can. See edit.

    – Ole Tange
    13 hours ago











  • gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

    – Relyativist
    11 hours ago











  • Of course it works with 9h.

    – Ole Tange
    7 hours ago
















0














You are looking for --timeout.



You can do --timeout 9h or you can do --timeout 1000%. The last will measure how long the median time is for a job to succeed, and given the median it will compute a timeout that is 1000% of the median run time.



The neat thing about using a percentage is that if the compute program gets faster or slower for the normal case, you will not need to change the timeout.



See it in action:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3
# Compute program gets 10 times faster
parallel --timeout 300% 'sleep =$_ /= 10 =; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3


The median (not average) runtime is measured as the median of the succesfully completed jobs (though minimum 3). So if you have 8 jobs with job 5 being infinite, it will get killed when the runtime hits the percentage of the median timeout:



parallel --timeout 300% 'sleep ; echo ' ::: 1 2 1 2 100 2 1 2


This also works if the first job is the one that is stuck:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 1 2 1 2 1 2


The only situation it does not work is if all jobslots are stuck on their first job:



parallel -j4 --timeout 300% 'sleep ; echo ' ::: 100 100 100 100 1 2 1 2





share|improve this answer

























  • The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

    – Relyativist
    13 hours ago











  • In most cases it can. See edit.

    – Ole Tange
    13 hours ago











  • gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

    – Relyativist
    11 hours ago











  • Of course it works with 9h.

    – Ole Tange
    7 hours ago














0












0








0







You are looking for --timeout.



You can do --timeout 9h or you can do --timeout 1000%. The last will measure how long the median time is for a job to succeed, and given the median it will compute a timeout that is 1000% of the median run time.



The neat thing about using a percentage is that if the compute program gets faster or slower for the normal case, you will not need to change the timeout.



See it in action:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3
# Compute program gets 10 times faster
parallel --timeout 300% 'sleep =$_ /= 10 =; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3


The median (not average) runtime is measured as the median of the succesfully completed jobs (though minimum 3). So if you have 8 jobs with job 5 being infinite, it will get killed when the runtime hits the percentage of the median timeout:



parallel --timeout 300% 'sleep ; echo ' ::: 1 2 1 2 100 2 1 2


This also works if the first job is the one that is stuck:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 1 2 1 2 1 2


The only situation it does not work is if all jobslots are stuck on their first job:



parallel -j4 --timeout 300% 'sleep ; echo ' ::: 100 100 100 100 1 2 1 2





share|improve this answer















You are looking for --timeout.



You can do --timeout 9h or you can do --timeout 1000%. The last will measure how long the median time is for a job to succeed, and given the median it will compute a timeout that is 1000% of the median run time.



The neat thing about using a percentage is that if the compute program gets faster or slower for the normal case, you will not need to change the timeout.



See it in action:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3
# Compute program gets 10 times faster
parallel --timeout 300% 'sleep =$_ /= 10 =; echo ' ::: 100 2 3 1 50 2 3 1 2 1 3 2 1 4 2 1 2 3


The median (not average) runtime is measured as the median of the succesfully completed jobs (though minimum 3). So if you have 8 jobs with job 5 being infinite, it will get killed when the runtime hits the percentage of the median timeout:



parallel --timeout 300% 'sleep ; echo ' ::: 1 2 1 2 100 2 1 2


This also works if the first job is the one that is stuck:



parallel --timeout 300% 'sleep ; echo ' ::: 100 2 1 2 1 2 1 2


The only situation it does not work is if all jobslots are stuck on their first job:



parallel -j4 --timeout 300% 'sleep ; echo ' ::: 100 100 100 100 1 2 1 2






share|improve this answer














share|improve this answer



share|improve this answer








edited 13 hours ago

























answered yesterday









Ole TangeOle Tange

12.9k1457107




12.9k1457107












  • The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

    – Relyativist
    13 hours ago











  • In most cases it can. See edit.

    – Ole Tange
    13 hours ago











  • gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

    – Relyativist
    11 hours ago











  • Of course it works with 9h.

    – Ole Tange
    7 hours ago


















  • The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

    – Relyativist
    13 hours ago











  • In most cases it can. See edit.

    – Ole Tange
    13 hours ago











  • gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

    – Relyativist
    11 hours ago











  • Of course it works with 9h.

    – Ole Tange
    7 hours ago

















The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

– Relyativist
13 hours ago





The problem is that issues can occur on first pack of patients, so 7 of 8 done, but e.g 5th have infinite runtime (because it stuck at "CORRECTING DEFECT 5 for example), so the parallel can't measure average processing time to --timeout with %

– Relyativist
13 hours ago













In most cases it can. See edit.

– Ole Tange
13 hours ago





In most cases it can. See edit.

– Ole Tange
13 hours ago













gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

– Relyativist
11 hours ago





gnu parallel doesn't work with 9h right? you should write it in seconds? 6000?

– Relyativist
11 hours ago













Of course it works with 9h.

– Ole Tange
7 hours ago






Of course it works with 9h.

– Ole Tange
7 hours ago


















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508693%2fgnu-parallel-exit-process-with-timeout%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







fAUp Hk6,T81roK2dAKf5D30m1npFhE6,uqUTqs16sHvrKyqqxKfqMWG000wYcwNL
cHwMZeqe6iLhGZ,g

Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

NetworkManager fails with “Could not find source connection”Trouble connecting to VPN using network-manager, while command line worksHow can I be notified about state changes to a VPN adapterBacktrack 5 R3 - Refuses to connect to VPNFeed all traffic through OpenVPN for a specific network namespace onlyRun daemon on startup in Debian once openvpn connection establishedpfsense tcp connection between openvpn and lan is brokenInternet connection problem with web browsers onlyWhy does NetworkManager explicitly support tun/tap devices?Browser issues with VPNTwo IP addresses assigned to the same network card - OpenVPN issues?Cannot connect to WiFi with nmcli, although secrets are provided

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.