Another approach might be to add all tasks to the queue. Before you finish, enter the N primary task log information in the data store, in some way, so that you can query the data store to make sure that they are all running.
When a dependent task is launched, it executes this data warehouse request to check if its conditions are met (it is checked that all initial tasks are registered, that they are completed). If not, you need to run it later.
To do this, the dependent task could add a copy to the queue scheduled to run after a certain period of time. Alternatively (as in the answer above), the dependent task may end with an error status code, in which case it will be automatically repeated at some later point if the retry_limit for the queue or task is not exceeded.
source share