diff --git a/app/http.php b/app/http.php index c55f6c8..b3d784f 100644 --- a/app/http.php +++ b/app/http.php @@ -285,12 +285,15 @@ function removeAllRuntimes(Table $activeRuntimes, Pool $orchestrationPool): void ->inject('orchestration') ->inject('activeRuntimes') ->inject('response') - ->action(function (string $runtimeId, string $image, string $entrypoint, string $source, string $destination, array $variables, array $commands, int $timeout, string $workdir, bool $remove, int $cpus, int $memory, Orchestration $orchestration, Table $activeRuntimes, Response $response) { + ->inject('log') + ->action(function (string $runtimeId, string $image, string $entrypoint, string $source, string $destination, array $variables, array $commands, int $timeout, string $workdir, bool $remove, int $cpus, int $memory, Orchestration $orchestration, Table $activeRuntimes, Response $response, Log $log) { $activeRuntimeId = $runtimeId; // Used with Swoole table (key) $runtimeId = System::getHostname() . '-' . $runtimeId; // Used in Docker (name) $runtimeHostname = \uniqid(); + $log->addTag('runtimeId', $activeRuntimeId); + if ($activeRuntimes->exists($activeRuntimeId)) { if ($activeRuntimes->get($activeRuntimeId)['status'] == 'pending') { throw new \Exception('A runtime with the same ID is already being created. Attempt a execution soon.', 500); @@ -506,7 +509,7 @@ function removeAllRuntimes(Table $activeRuntimes, Pool $orchestrationPool): void ->action(function (string $runtimeId, Table $activeRuntimes, Response $response, Log $log) { $activeRuntimeId = $runtimeId; // Used with Swoole table (key) - $log->addExtra('runtimeId', $activeRuntimeId); + $log->addTag('runtimeId', $activeRuntimeId); if (!$activeRuntimes->exists($activeRuntimeId)) { throw new Exception('Runtime not found', 404); @@ -530,7 +533,7 @@ function removeAllRuntimes(Table $activeRuntimes, Pool $orchestrationPool): void $activeRuntimeId = $runtimeId; // Used with Swoole table (key) $runtimeId = System::getHostname() . '-' . $runtimeId; // Used in Docker (name) - $log->addExtra('runtimeId', $activeRuntimeId); + $log->addTag('runtimeId', $activeRuntimeId); if (!$activeRuntimes->exists($activeRuntimeId)) { throw new Exception('Runtime not found', 404); @@ -565,7 +568,7 @@ function (string $runtimeId, string $payload, array $variables, int $timeout, st $activeRuntimeId = $runtimeId; // Used with Swoole table (key) $runtimeId = System::getHostname() . '-' . $runtimeId; // Used in Docker (name) - $log->addExtra('runtimeId', $activeRuntimeId); + $log->addTag('runtimeId', $activeRuntimeId); $variables = \array_merge($variables, [ 'INERNAL_EXECUTOR_HOSTNAME' => System::getHostname()