How to create an exclusive job which waits for other specific jobs to finish?

We have 3-4 data collection ETL type jobs which connect to remote server and download a bunch of data. Once the data has been downloaded, cleansed - we need to run some long running calculation tasks. But we cannot run the calculation tasks while ETL jobs are running. Is there a way I can easily configure the calculation job to wait for the ETL jobs to finish? I am not using MSMQ or RabbitMQ at this stage because most of our jobs are just simple cron jobs which need to run on nightly basis.

Thanks in advance.

@manuj, I’m not sure if this is the best solution but you could do something like this:

Split this in two parts; (1) Download the data, (2) Do calculations.

So you could:

  1. Create a recurring job (that runs daily) for the ETL type job that downloads the bunch of data.
  2. When that is done, (at the end of the code that fetches the data) you can enqueue a job (not a recurring job) that does the long running calculations.

This way, you know that second job only runs after (and if) the first job successfully executed.

I hope this helps.

To the Hangfire experts out there: Please correct me if there’s another (better) way. :slight_smile: