🔄 How to correctly push status updates for parallel jobs using BullMQ and Airflow #3394
Unanswered
NicolasBearingPoint
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
Have you looked into flows to see if there is anything there that can help you in your use case?https://docs.bullmq.io/guide/flows https://blog.taskforce.sh/splitting-heavy-jobs-using-bullmq-flows/ |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi BullMQ team 👋
I'm using BullMQ in combination with Apache Airflow as an event-driven system. I understand that Airflow isn't natively designed for such an architecture, but it works well in practice for our use case. However, I’m facing a design challenge around job tracking and parallel executions.
Context:
{dags-trigger}queue to trigger Airflow DAGs.{dags-finished}queue is used to track the final status of each DAG.{dags-trigger}), include a final task that needs to update the job with the matching unique_id in the{dags-finished}queue.Since multiple DAGs can be running concurrently, each final task creates a BullMQ worker that consumes jobs from
{dags-finished}in FIFO order.Problem:
How can I reliably find and update the exact job (matching unique_id) in a shared queue without blocking other jobs needed by other concurrently running DAGs?
Describe alternatives you've considered:
The workaround I’ve implemented is as follows:
Scripts.moveToDelayed()and thenScripts.promoteJobs()to push the job back into the queue, and continue the loop.Caveats:
I had to add a time.sleep of ~1s when triggering the DAG to avoid race conditions, especially when two DAGs are triggered at the exact same time or within a very short delay (less than the delay of the moved job).
This problem does not occur when triggering DAGs, since those jobs are handled sequentially and don’t depend on matching parameters.
Question:
Is there a better way to find and update a specific job in a shared queue (e.g., by ID or metadata) without consuming it first via FIFO?
Have you faced
Or is there a BullMQ-native way to target a job in a queue (e.g., by jobId or unique_id) and change its state directly?
Any help or best practices would be greatly appreciated. Thanks for the great work on BullMQ! 🙏
Beta Was this translation helpful? Give feedback.
All reactions