Initial commit
This commit is contained in:
71
app/Jobs/DispatchMatchJobsJob.php
Normal file
71
app/Jobs/DispatchMatchJobsJob.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user