Best Python code snippet using autotest_python
scheduler_models.py
Source:scheduler_models.py  
...744                            models.HostQueueEntry.Status.RUNNING,745                            models.HostQueueEntry.Status.COMPLETED)746        started_entries = atomic_entries.filter(status__in=started_statuses)747        return started_entries.count() > 0748    def _hosts_assigned_count(self):749        """The number of HostQueueEntries assigned a Host for this job."""750        entries = models.HostQueueEntry.objects.filter(job=self.id,751                                                       host__isnull=False)752        return entries.count()753    def _pending_count(self):754        """The number of HostQueueEntries for this job in the Pending state."""755        pending_entries = models.HostQueueEntry.objects.filter(756                job=self.id, status=models.HostQueueEntry.Status.PENDING)757        return pending_entries.count()758    def _max_hosts_needed_to_run(self, atomic_group):759        """760        @param atomic_group: The AtomicGroup associated with this job that we761                are using to set an upper bound on the threshold.762        @returns The maximum number of HostQueueEntries assigned a Host before763                this job can run.764        """765        return min(self._hosts_assigned_count(),766                   atomic_group.max_number_of_machines)767    def _min_hosts_needed_to_run(self):768        """Return the minumum number of hsots needed to run this job."""769        return self.synch_count770    def is_ready(self):771        # NOTE: Atomic group jobs stop reporting ready after they have been772        # started to avoid launching multiple copies of one atomic job.773        # Only possible if synch_count is less than than half the number of774        # machines in the atomic group.775        pending_count = self._pending_count()776        atomic_and_has_started = self._atomic_and_has_started()777        ready = (pending_count >= self.synch_count778                 and not atomic_and_has_started)779        if not ready:...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
