Files
vkv/app/Jobs/PauseEvaluationRunJob.php
Zdeněk Burda 41e3ce6f25 Initial commit
2026-01-09 21:26:40 +01:00

57 lines
1.6 KiB
PHP

<?php
namespace App\Jobs;
use App\Models\EvaluationRun;
use App\Services\Evaluation\EvaluationCoordinator;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Throwable;
class PauseEvaluationRunJob implements ShouldQueue
{
use Queueable;
public function __construct(
protected int $evaluationRunId,
protected string $status,
protected string $step,
protected string $message
) {
}
public function handle(): void
{
$run = EvaluationRun::find($this->evaluationRunId);
if (! $run || $run->isCanceled()) {
return;
}
$coordinator = app(EvaluationCoordinator::class);
try {
$coordinator->eventInfo($run, 'Pause: krok spuštěn.', [
'step' => $this->step,
'round_id' => $run->round_id,
]);
$coordinator->transition($run, '*', $this->status, $this->step);
// WAITING_* stavy umožňují manuální zásah rozhodčího mezi fázemi pipeline.
$coordinator->eventInfo($run, $this->message, [
'step' => $this->step,
'round_id' => $run->round_id,
]);
$coordinator->eventInfo($run, 'Pause: krok dokončen.', [
'step' => $this->step,
'round_id' => $run->round_id,
]);
} catch (Throwable $e) {
$coordinator->eventError($run, 'Pause: krok selhal.', [
'step' => $this->step,
'round_id' => $run->round_id,
'error' => $e->getMessage(),
]);
throw $e;
}
}
}