def schedule(self):
        self.log.info("Master | running scheduler %d/%d",
                      self.slots_available, self.slots_total)
        # find next jobs that can be executed and run it
        #
        # sort all queued jobs
        sorted_jobs = sorted(self.queued.values())
        # now iterate the jobs and run the first one that fits
        # into the available slots
        for job in sorted_jobs:
            if len(job.dependencies) > 0:
                # not all dependencies are resolved
                self.log.info("Master | No jobs without dependencies found")
                break
            if job.threads <= self.slots_available:
                self.log.info("Master | Submitting job for execution %s",
                              job.job_id)
                # start this one
                self._run_job(job)
                # update slots
                self.slots_available -= job.threads
                # if we still have slots open,
                # start another scheduling
                if self.slots_available >= 1:
                    self.schedule()
                return
dataset/ETHPy150Open thasso/pyjip/jip/grids.py/_GridMaster.schedule/original