diff --git a/laravel_app/app/Jobs/ProjectDownloadTiffJob.php b/laravel_app/app/Jobs/ProjectDownloadTiffJob.php index e5ea6d5..8f0486e 100644 --- a/laravel_app/app/Jobs/ProjectDownloadTiffJob.php +++ b/laravel_app/app/Jobs/ProjectDownloadTiffJob.php @@ -58,7 +58,6 @@ public function handle(): void logger($process->getOutput()); $this->download->setStatusSuccess(); dispatch(ProjectDownloadRDSJob::fromDate($this->download->project, $this->date, $this->days)); - } public static function handleForDate(Project $project, Carbon $date) diff --git a/laravel_app/app/Jobs/ProjectInterpolateGrowthModelJob.php b/laravel_app/app/Jobs/ProjectInterpolateGrowthModelJob.php new file mode 100644 index 0000000..0e02540 --- /dev/null +++ b/laravel_app/app/Jobs/ProjectInterpolateGrowthModelJob.php @@ -0,0 +1,49 @@ +project = $project; + } + + /** + * Execute the job. + */ + public function handle(): void + { + $command = [ + sprintf('%interpolate_growth_model.sh', base_path('../')), + sprintf('--project_dir=%s', $this->project->download_path), + ]; + + $process = new Process($command); + $process->setTimeout(600); + $process->run(); + + if (!$process->isSuccessful()) { + logger('error', [$process->getErrorOutput()]); + return; + } + logger($process->getOutput()); + + } +} diff --git a/laravel_app/app/Models/Project.php b/laravel_app/app/Models/Project.php index 17c63c7..2dc31ae 100644 --- a/laravel_app/app/Models/Project.php +++ b/laravel_app/app/Models/Project.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Jobs\ProjectDownloadTiffJob; +use App\Jobs\ProjectInterpolateGrowthModelJob; use App\Jobs\ProjectMosiacGeneratorJob; use App\Jobs\ProjectReportGeneratorJob; use Carbon\CarbonPeriod; @@ -306,7 +307,11 @@ public function scheduleReport(?Carbon $endDate = null, ?int $offset = null) Bus::chain([ Bus::batch($this->getFileDownloadsFor($endDate, $offset)), Bus::batch($this->getMosaicsFor($endDate, $offset)), - Bus::batch([$this->getReportFor($endDate, $offset,true)]), + Bus::batch( + [ + new ProjectInterpolateGrowthModelJob($this), + $this->getReportFor($endDate, $offset,true) + ]), ]) ->dispatch(); return "done";