composeer update

This commit is contained in:
2019-06-23 11:49:01 +00:00
parent fc2380d68c
commit e9efe70112
327 changed files with 5194 additions and 2278 deletions
+5 -22
View File
@@ -13,27 +13,6 @@ class SystemProcessCounter
*/
public static $command = 'horizon:work';
/**
* Get CPU and memory usage for each Horizon workers for a given supervisor.
*
* @param string $name
* @return \Illuminate\Support\Collection
*/
public function getWorkerStats($name)
{
$process = Process::fromShellCommandline('exec ps axo %cpu,%mem,command | grep '.static::$command.' | grep "supervisor='.$name.'" | grep -v "exec ps axo"', null, ['COLUMNS' => '2000']);
$process->run();
$rows = explode("\n", $process->getOutput());
return collect($rows)->filter()->map(function ($rows) {
$row = collect(explode(' ', $rows))->filter()->take(2);
return ['cpu' => $row->first() / 100, 'mem' => $row->last()];
});
}
/**
* Get the number of Horizon workers for a given supervisor.
*
@@ -42,6 +21,10 @@ class SystemProcessCounter
*/
public function get($name)
{
return $this->getWorkerStats($name)->count();
$process = Process::fromShellCommandline('exec ps aux | grep '.static::$command, null, ['COLUMNS' => '2000']);
$process->run();
return substr_count($process->getOutput(), 'supervisor='.$name);
}
}