Submit job only after previous job completes?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












I have tried with this one:
cat sub-1.sh



#!/bin/sh

jid1=$(sbatch job1.sh)

#job can depend on a single job
jid2=$(sbatch --dependency=afterany:$jid1 job2.sh)


But it does not hold the job and showing this error:
sbatch: error: Batch job submission failed: Job dependency problem.










share|improve this question



















  • 1




    What do you mean "it fails"? Fails how? My guess would be that sbatch submits to the queue and then returns, so "it fails" means it doesn't wait.
    – KevinO
    Sep 25 at 15:10










  • Yes, Sir, your guess is right. All the jobs run simultaneously.
    – Saikat Pal
    Sep 25 at 15:34










  • In general, the approach would be that you get back the job id from the submission, then create a dependency on the next submission. See, e.g., this link. If what you are using doesn't support dependency chaining, then you have to do something to wait on notification. You can add to the submitted job an e-mail, or a posting to a queue, or you can poll the queue state using the returned jobid.
    – KevinO
    Sep 25 at 15:39










  • If you want the jobs to execute sequentially, why do you queue them?
    – RalfFriedl
    Sep 25 at 17:18










  • To continue on @RalfFriedl's train of thought; why do you queue them separately?
    – Kusalananda
    Sep 26 at 6:32














up vote
-1
down vote

favorite












I have tried with this one:
cat sub-1.sh



#!/bin/sh

jid1=$(sbatch job1.sh)

#job can depend on a single job
jid2=$(sbatch --dependency=afterany:$jid1 job2.sh)


But it does not hold the job and showing this error:
sbatch: error: Batch job submission failed: Job dependency problem.










share|improve this question



















  • 1




    What do you mean "it fails"? Fails how? My guess would be that sbatch submits to the queue and then returns, so "it fails" means it doesn't wait.
    – KevinO
    Sep 25 at 15:10










  • Yes, Sir, your guess is right. All the jobs run simultaneously.
    – Saikat Pal
    Sep 25 at 15:34










  • In general, the approach would be that you get back the job id from the submission, then create a dependency on the next submission. See, e.g., this link. If what you are using doesn't support dependency chaining, then you have to do something to wait on notification. You can add to the submitted job an e-mail, or a posting to a queue, or you can poll the queue state using the returned jobid.
    – KevinO
    Sep 25 at 15:39










  • If you want the jobs to execute sequentially, why do you queue them?
    – RalfFriedl
    Sep 25 at 17:18










  • To continue on @RalfFriedl's train of thought; why do you queue them separately?
    – Kusalananda
    Sep 26 at 6:32












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have tried with this one:
cat sub-1.sh



#!/bin/sh

jid1=$(sbatch job1.sh)

#job can depend on a single job
jid2=$(sbatch --dependency=afterany:$jid1 job2.sh)


But it does not hold the job and showing this error:
sbatch: error: Batch job submission failed: Job dependency problem.










share|improve this question















I have tried with this one:
cat sub-1.sh



#!/bin/sh

jid1=$(sbatch job1.sh)

#job can depend on a single job
jid2=$(sbatch --dependency=afterany:$jid1 job2.sh)


But it does not hold the job and showing this error:
sbatch: error: Batch job submission failed: Job dependency problem.







shell-script job-control batch-jobs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 26 at 5:54

























asked Sep 25 at 14:54









Saikat Pal

61




61







  • 1




    What do you mean "it fails"? Fails how? My guess would be that sbatch submits to the queue and then returns, so "it fails" means it doesn't wait.
    – KevinO
    Sep 25 at 15:10










  • Yes, Sir, your guess is right. All the jobs run simultaneously.
    – Saikat Pal
    Sep 25 at 15:34










  • In general, the approach would be that you get back the job id from the submission, then create a dependency on the next submission. See, e.g., this link. If what you are using doesn't support dependency chaining, then you have to do something to wait on notification. You can add to the submitted job an e-mail, or a posting to a queue, or you can poll the queue state using the returned jobid.
    – KevinO
    Sep 25 at 15:39










  • If you want the jobs to execute sequentially, why do you queue them?
    – RalfFriedl
    Sep 25 at 17:18










  • To continue on @RalfFriedl's train of thought; why do you queue them separately?
    – Kusalananda
    Sep 26 at 6:32












  • 1




    What do you mean "it fails"? Fails how? My guess would be that sbatch submits to the queue and then returns, so "it fails" means it doesn't wait.
    – KevinO
    Sep 25 at 15:10










  • Yes, Sir, your guess is right. All the jobs run simultaneously.
    – Saikat Pal
    Sep 25 at 15:34










  • In general, the approach would be that you get back the job id from the submission, then create a dependency on the next submission. See, e.g., this link. If what you are using doesn't support dependency chaining, then you have to do something to wait on notification. You can add to the submitted job an e-mail, or a posting to a queue, or you can poll the queue state using the returned jobid.
    – KevinO
    Sep 25 at 15:39










  • If you want the jobs to execute sequentially, why do you queue them?
    – RalfFriedl
    Sep 25 at 17:18










  • To continue on @RalfFriedl's train of thought; why do you queue them separately?
    – Kusalananda
    Sep 26 at 6:32







1




1




What do you mean "it fails"? Fails how? My guess would be that sbatch submits to the queue and then returns, so "it fails" means it doesn't wait.
– KevinO
Sep 25 at 15:10




What do you mean "it fails"? Fails how? My guess would be that sbatch submits to the queue and then returns, so "it fails" means it doesn't wait.
– KevinO
Sep 25 at 15:10












Yes, Sir, your guess is right. All the jobs run simultaneously.
– Saikat Pal
Sep 25 at 15:34




Yes, Sir, your guess is right. All the jobs run simultaneously.
– Saikat Pal
Sep 25 at 15:34












In general, the approach would be that you get back the job id from the submission, then create a dependency on the next submission. See, e.g., this link. If what you are using doesn't support dependency chaining, then you have to do something to wait on notification. You can add to the submitted job an e-mail, or a posting to a queue, or you can poll the queue state using the returned jobid.
– KevinO
Sep 25 at 15:39




In general, the approach would be that you get back the job id from the submission, then create a dependency on the next submission. See, e.g., this link. If what you are using doesn't support dependency chaining, then you have to do something to wait on notification. You can add to the submitted job an e-mail, or a posting to a queue, or you can poll the queue state using the returned jobid.
– KevinO
Sep 25 at 15:39












If you want the jobs to execute sequentially, why do you queue them?
– RalfFriedl
Sep 25 at 17:18




If you want the jobs to execute sequentially, why do you queue them?
– RalfFriedl
Sep 25 at 17:18












To continue on @RalfFriedl's train of thought; why do you queue them separately?
– Kusalananda
Sep 26 at 6:32




To continue on @RalfFriedl's train of thought; why do you queue them separately?
– Kusalananda
Sep 26 at 6:32















active

oldest

votes











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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
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%2f471351%2fsubmit-job-only-after-previous-job-completes%23new-answer', 'question_page');

);

Post as a guest



































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%2funix.stackexchange.com%2fquestions%2f471351%2fsubmit-job-only-after-previous-job-completes%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?