Exemplo n.º 1
0
 /**
  * Determine if there are any builds pending, and launch any of those builds up to the max number of builds
  * allowed to run at once.
  */
 public function run()
 {
     $building = $this->buildRepository->getBy(['status' => 'building']);
     if (count($building) < $this->maxBuildsInProgress) {
         $pending = $this->buildRepository->getBy(['status' => 'pending'], ['created' => 'ASC'], $this->maxBuildsInProgress - count($building));
         foreach ($pending as $build) {
             // Find a cleaner, more graceful way to do this:
             exec('./bin/martha ' . $build->getId() . ' > /dev/null &');
         }
     }
 }