Spaces:
Running
Running
Download app/Jobs/RunScreeningJob.php from Ailixir-AI-Team/ailixir-api: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/Ailixir-AI-Team/ailixir-api/resolve/main/app/Jobs/RunScreeningJob.php
- Command line
-
hf download hf://spaces/Ailixir-AI-Team/ailixir-api/app/Jobs/RunScreeningJob.php
-
curl -L -o RunScreeningJob.php https://huggingface.co/spaces/Ailixir-AI-Team/ailixir-api/resolve/main/app/Jobs/RunScreeningJob.php
1.19 kB
| namespace App\Jobs; | |
| use Illuminate\Contracts\Queue\ShouldQueue; | |
| use Illuminate\Foundation\Queue\Queueable; | |
| class RunScreeningJob implements ShouldQueue | |
| { | |
| use Queueable; | |
| public function __construct(protected \App\Models\ScreeningResult $screeningResult) {} | |
| public function handle(\App\Services\ScreeningService $screeningService): void | |
| { | |
| $this->screeningResult->update(['status' => 'processing']); | |
| try { | |
| $input = $this->screeningResult->input; | |
| $output = $screeningService->screen($input); | |
| if (is_array($output)) { | |
| unset($output['warnings']); | |
| } | |
| $this->screeningResult->update([ | |
| 'output' => $output, | |
| 'status' => 'completed', | |
| ]); | |
| } catch (\Exception $e) { | |
| \Illuminate\Support\Facades\Log::error('Screening job failed', [ | |
| 'id' => $this->screeningResult->id, | |
| 'error' => $e->getMessage() | |
| ]); | |
| $this->screeningResult->update([ | |
| 'status' => 'failed', | |
| 'output' => ['error' => $e->getMessage()], | |
| ]); | |
| } | |
| } | |
| } | |