ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.97k stars 3.41k forks source link

Starting job execution along with inventory sync #12091

Open gabhishek627 opened 2 years ago

gabhishek627 commented 2 years ago
ISSUE TYPE

COMPONENT NAME

SUMMARY
AlanCoding commented 2 years ago

@fosterseth we have some history with loosening up these blocking rules in the past. Could you read through this and give any thoughts?

fosterseth commented 2 years ago

@gabhishek627

In your scenario, removing the block would mean those jobs running alongside the inventory update might not get the latest changes pulled in from the inventory update. Of course, if you need the job to wait on an update, you can make sure Update On Launch is set to true on the inventory source.

@AlanCoding

here is the dependency_graph.py code to determine if the Job can run,

def job_blocked_by(self, job):
    project_block = self.get_item(self.PROJECT_UPDATES, job.project_id)
    inventory_block = self.get_item(self.INVENTORY_UPDATES, job.inventory_id)
    if job.allow_simultaneous is False:
        job_block = self.get_item(self.JOB_TEMPLATE_JOBS, job.job_template_id)
    else:
        job_block = None
    return project_block or inventory_block or job_block

we may wish to remove the project_block and inventory_block conditions, and just have the job_block condition.

If a job really needs to wait on an inventory source update, it would have added it to the dependent_jobs field, and be blocked that way.

AlanCoding commented 2 years ago

We may need to investigate what will happen if we generate inventory while an inventory update is happening. The update is inside of a transaction. If the inventory were to simply get the inventory pre-update, I'd be fine with that. If it gets content half-way through the update, we'd have to add some guard rails to prevent that.

I believe we also need to increase the rigor with which we manage the project local lock.