public function table($id) { $simulation = Simulation::find($id); return ['patient' => $simulation->patient, 'context' => $simulation->contextName, 'id' => $simulation->Id, 'timestamp' => $simulation->creationDate]; }
protected function completed_simulation($args, $session) { $s = Simulation::find($args[0]); if (!$s || $s->State == 0) { $this->info("Irrelevant completion : " . $s->Id); return; } $this->info('Simulation ' . $args[0] . ' completed'); if ($s->isDevelopment()) { $this->info('Simulation is marked as a development run, so updating DB and pushing our result'); $guid = strtoupper($this->gen_uuid()); $this->info('New file: ' . $guid); DB::table('ItemSet')->insert(['Id' => $guid, 'CreationDate' => date('Y-m-d H:i:s'), 'IsDeleted' => 0, 'Version' => 1]); DB::table('ItemSet_File')->insert(['Id' => $guid, 'State' => 0, 'FileName' => 'NUMA_External_Simulation', 'Extension' => 'vtp']); $target = $this->httpTransferrerUploadBase . '/' . strtolower($guid) . '/name/NUMA_External_Simulation'; $session->call($this->prefix . '.request_files', [$s->Id, ['output/lesion_surface.vtp' => $target]])->then(function ($res) use($guid, $s) { $this->info('Uploaded result ' . $guid . ' for simulation ' . $s->Id); DB::table('ItemSet_VtkFile')->insert(['Id' => $guid, 'Simulation_Id' => strtoupper($s->Id)]); $s->Progress = 100; $s->State = 3; $s->save(); $this->info('Processing complete, reported and uploaded'); //$this->upload_signal($s, 'last_message'); }, function ($err) { $this->error($err); }); } Mail::send('emails.completed_sim', ['guid' => $args[0]], function ($message) { $message->to('*****@*****.**', 'Phil Weir')->subject('Simulation succeeded'); }); }