wip
This commit is contained in:
parent
819a058345
commit
915284ba04
|
|
@ -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)
|
||||
|
|
|
|||
49
laravel_app/app/Jobs/ProjectInterpolateGrowthModelJob.php
Normal file
49
laravel_app/app/Jobs/ProjectInterpolateGrowthModelJob.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Project;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Batchable;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class ProjectInterpolateGrowthModelJob implements ShouldQueue
|
||||
{
|
||||
use Batchable, Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
protected Project $project;
|
||||
protected Carbon $date;
|
||||
protected int $offset;
|
||||
|
||||
public function __construct(Project $project)
|
||||
{
|
||||
$this->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());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Reference in a new issue