From 819a05834524911ef1d74fcb179f6120b4d16363 Mon Sep 17 00:00:00 2001 From: Guillaume Marteau Date: Thu, 27 Jun 2024 15:30:47 +0200 Subject: [PATCH] cleaning --- .../app/Jobs/ProjectMosiacGeneratorJob.php | 67 ------------------- 1 file changed, 67 deletions(-) diff --git a/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php b/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php index bcdba25..179aded 100644 --- a/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php +++ b/laravel_app/app/Jobs/ProjectMosiacGeneratorJob.php @@ -38,53 +38,12 @@ public function __construct(ProjectMosaic $mosaic) /** * Execute the job. */ - public function handleNew(): void - { - //$weeksAgo = ProjectReport::weeksAgoForYearAndWeek($this->mosaic->year, $this->mosaic->week); - - //TODO change to end_date and offset - - $projectFolder = base_path('../'); - - $command = [ - sprintf('%sbuild_mosaic.sh', $projectFolder), - sprintf('--end_date=%s', $this->mosaic->end_date), - sprintf('--offset=%s', $this->mosaic->offset), - sprintf('--data_dir=%s', $this->mosaic->project->download_path), - ]; - - $process = new Process($command); - $process->setTimeout(220); - $currentPath = '/usr/bin:/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin/Users/mfolkerts/anaconda3/bin:/Library/Apple/usr/bin'; - - $process->setEnv(['PATH' => $currentPath.':/usr/local/Cellar/pandoc/3.1.8/bin/pandoc']); -// $process->setTimeout(36000); // stel een geschikte timeout in - $process->start(); - try { - $myOutput = []; - $process->wait(function ($type, $buffer) use (&$myOutput) { -// $this->stream(to: 'processOutput', content: $buffer); - $myOutput[] = $buffer; - logger($buffer); - }); - $this->processOutput = collect($myOutput)->join('\n'); - $this->mosaic->setStatusSuccess(); - - } catch (ProcessFailedException $exception) { - echo $exception->getMessage(); - $this->mosaic->setStatusFailed(); - - } - } /** * Execute the job. */ public function handle(): void { - //$weeksAgo = ProjectReport::weeksAgoForYearAndWeek($this->mosaic->year, $this->mosaic->week); - - $projectFolder = base_path('../'); $command = [ @@ -111,32 +70,6 @@ public function handle(): void } } -// public static function handleFor(Project $project, $year, $startWeekNumber) -// { -// logger("ProjectMosiacGeneratorJob::handleFor(week $startWeekNumber, year $year)"); -// if ($project->hasInvalidMosaicFor($year, $startWeekNumber)) { -// logger("ProjecMosaicGeneratorJob::handleFor(week $startWeekNumber, year $year): InvalidMosaic."); -// return new NullJob(); -// } -// -// $mosaic = $project->mosaics()->updateOrCreate( -// [ -// 'year' => $year, -// 'week' => $startWeekNumber, -// ], -// [ -// 'name' => sprintf('Week %d, %d', $startWeekNumber, $year), -// 'path' => sprintf('%s/%s/%s', -// $project->download_path, -// 'mosaics', -// ProjectMosaic::getFilenameForYearAndWeek($year, $startWeekNumber) -// ), -// 'year' => $year, -// 'week' => $startWeekNumber, -// ]); -// return new self($mosaic); -// } - /** * Check if the project has a mosaic for given period. */