refs #2613. Captured busy client status
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
parent
17bb13393f
commit
8a8f67b776
|
@ -47,6 +47,10 @@ class RunScriptAction extends AbstractOgAgentController
|
|||
$data = $this->buildRequestData($client, $input->script);
|
||||
$response = $this->executeScript($client, $data);
|
||||
|
||||
if (isset($response['code']) && $response['code'] === 409) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->isErrorResponse($response)) {
|
||||
$this->handleError($client, $input, $response);
|
||||
continue;
|
||||
|
@ -98,7 +102,7 @@ class RunScriptAction extends AbstractOgAgentController
|
|||
|
||||
private function executeScript(Client $client, array $data): array
|
||||
{
|
||||
return $this->createRequest(
|
||||
$response = $this->createRequest(
|
||||
method: 'POST',
|
||||
url: 'https://'.$client->getIp().':8000/opengnsys/EjecutarScript',
|
||||
params: [
|
||||
|
@ -106,6 +110,23 @@ class RunScriptAction extends AbstractOgAgentController
|
|||
],
|
||||
token: $client->getToken(),
|
||||
);
|
||||
|
||||
if (isset($response['code']) && $response['code'] === 409) {
|
||||
$this->createService->__invoke(
|
||||
$client,
|
||||
CommandTypes::RUN_SCRIPT,
|
||||
TraceStatus::BUSY,
|
||||
null,
|
||||
['script' => $data['script'] ?? $data['scp'] ?? ''],
|
||||
'Some job is already running, refusing to launch another one'
|
||||
);
|
||||
|
||||
$this->logger->info('Trace created as busy due to 409 response', [
|
||||
'client_ip' => $client->getIp()
|
||||
]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function isErrorResponse(array $response): bool
|
||||
|
|
Loading…
Reference in New Issue