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

72 lines
1.9 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;
/**
* Job: DispatchMatchJobsJob
*
* Účel:
* - Koordinuje matchovací část pipeline (PASS 1 + PASS 2) po skupinách.
* - Nastaví progress pro krok match a připraví navazující kroky
* (UnpairedClassificationJob, DuplicateResolutionJob).
*
* Vstup:
* - evaluation_run_id
*
* Výstup:
* - Spuštěné batch joby MatchQsoBucketJob (PASS 1/2),
* následné joby pro klasifikaci a duplicity.
*
* Co job NEDĚLÁ:
* - neprovádí matching ani scoring,
* - nezapisuje QSO výsledky,
* - neagreguje výsledky.
*/
class DispatchMatchJobsJob implements ShouldQueue
{
use Queueable;
public int $tries = 2;
public array $backoff = [30];
public function __construct(
protected int $evaluationRunId
) {
}
public function handle(): void
{
$run = EvaluationRun::find($this->evaluationRunId);
if (! $run || $run->isCanceled()) {
return;
}
$coordinator = app(EvaluationCoordinator::class);
$coordinator->eventInfo($run, 'Dispatch match: krok spuštěn.', [
'step' => 'dispatch_match',
'round_id' => $run->round_id,
]);
try {
$coordinator->dispatchStep($run, 'match');
$coordinator->eventInfo($run, 'Dispatch match: krok dokončen.', [
'step' => 'dispatch_match',
'round_id' => $run->round_id,
]);
} catch (Throwable $e) {
$coordinator->eventError($run, 'Dispatch match: krok selhal.', [
'step' => 'dispatch_match',
'round_id' => $run->round_id,
'error' => $e->getMessage(),
]);
throw $e;
}
}
}