Ejemplo n.º 1
0
 /**
  * Given a list of servers gets the versions if possible
  *
  * @param array Server addresses
  * @return array Servers with appended version info
  */
 public function getStatuses($servers)
 {
     foreach ($servers as &$server) {
         try {
             $germanManager = new Manager($server['address']);
             $server['version'] = $germanManager->version();
         } catch (\Exception $e) {
             //Unable to connect to server
             $server['version'] = 'None';
         }
     }
     return $servers;
 }
Ejemplo n.º 2
0
 /**
  * Given a list of servers gets the current queue from them
  *
  * @param array Server addresses
  * @return array Servers with appended queue info
  */
 public function getQueue($servers)
 {
     foreach ($servers as &$server) {
         try {
             $germanManager = new Manager($server['address']);
             $server['queue'] = $germanManager->status();
         } catch (\Exception $e) {
             //Unable to connect to server or workers unresponsive
             $server['queue'] = [];
         }
     }
     return $servers;
 }
Ejemplo n.º 3
0
 /**
  * Given a list of servers gets all workers
  *
  * @param array Server addresses
  * @return array Servers with appended worker info
  */
 public function getWorkers($servers)
 {
     foreach ($servers as &$server) {
         try {
             $germanManager = new Manager($server['address']);
             $workers = $germanManager->workers();
             foreach ($workers as $worker) {
                 $server['workers'][] = $worker;
             }
         } catch (\Exception $e) {
             //Unable to connect or worker unresponsive
             $server['workers'] = [];
         }
     }
     return $servers;
 }