question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parent job does not execute when child job fails

See original GitHub issue

I have a FlowProducer that runs a parent job after a set of children jobs have been executed. There are about 10k children that are being run concurrently. I’ve set the option removeOnFail to true on both the children and the parents but it seems that if a child fail the execution of the parent just hangs.

Could this be a bug or is it a configuration issue on my side?

Here is what the code that create the job looks like:

export const initializeCollectionStats = async () => {
  const flowProducer = new FlowProducer({connection: redisClient, sharedConnection: true});
  const totalSupply = 10000
  const tokenJobs = [];
  for (let i = firstTokenID; i <= totalSupply; i++) {
    tokenJobs.push({
      name: 'child',
      data: {
        hello: 'world'
      },
      queueName: "queueName",
      opts: {
        removeOnFail: true,
        attempts: 2,
        timeout: 3000
      }
    })
  }

  const initJob = await flowProducer.add({
    name: 'initProject',
    data: {
      contractAddress
    },
    queueName: PROJECT_INIT_QUEUE,
    children: tokenJobs,
    opts: {
      attempts: 1
    }
  })

  return initJob
}

and the worker that run the children job looks like this:

const worker = new Worker(QUEUE_NAME, async (job) => {
    const { hello } = job.data
    try {
        const metadata = await doSomethingAsync(hello)
        return "done"
    } catch (e) {
        logger.error(e)
        return null
    }
}, { connection: redisClient, concurrency: 300, sharedConnection: true});

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
roggervalfcommented, Feb 14, 2022

This is in my pending list, this week I can work on this feature 👀

2reactions
manastcommented, Oct 8, 2021

Currently by design, until all child jobs have been completed the parent job will not be processed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parent job is not failing even after Child job failure
We are facing an issue, Parent job is not failing even after failure of child job , Due to this our job flow...
Read more >
How to end a parent Job when a child job fails - Stack Overflow
I'm a bit confused. If you run a child job from Spring Batch and the child job fails (BatchStatus = FAILED), the parent...
Read more >
Child pipeline job does not wait for parent pipeline ... - GitLab
Job in child pipeline that needs parent pipeline job, does not wait for parent pipeline job to complete before attempting to download artifacts....
Read more >
SM37 - BATCH JOBS - Parent job status says FINISHED even ...
This parent job automatically triggers 3 different child jobs under it. The status of the parent job is marked as 'Finished' even when...
Read more >
some of parent jobs stuck after their child finish - VOX
Is it occassional issue or always getting stuck and end up cancelling the backups?It might be backup stuck to execute the next child...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found