From 2bef973b2de9f27a96ad52889c921474a592b376 Mon Sep 17 00:00:00 2001 From: zagganas Date: Tue, 17 May 2022 08:51:00 +0000 Subject: [PATCH] Fixed re-run when software is not found --- controllers/SoftwareController.php | 18 +++++++++++++++--- models/Software.php | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/controllers/SoftwareController.php b/controllers/SoftwareController.php index 61d03f2..7095a00 100644 --- a/controllers/SoftwareController.php +++ b/controllers/SoftwareController.php @@ -921,7 +921,9 @@ public function actionRerun($jobid) if (empty($history)) { - return $this->render('job_not_found',['jobid'=>$jobid]); + $message="Job $jobid could not be found in our system."; + Yii::$app->session->setFlash('danger', "$message"); + return $this->redirect(['software/history']); } /* @@ -1004,7 +1006,9 @@ public function actionReattach($jobid) $history=RunHistory::find()->where(['jobid'=>$jobid])->one(); if (empty($history)) { - return $this->render('job_not_found',['jobid'=>$jobid]); + $message="Job $jobid could not be found in our system."; + Yii::$app->session->setFlash('danger', "$message"); + return $this->redirect(['software/history']); } $name=$history->softname; @@ -1015,7 +1019,15 @@ public function actionReattach($jobid) $maxMem=$history->max_ram; $maxCores=$history->max_cpu; $outFolder=$history->omountpoint; - $software=Software::find()->where(['name'=>$name,'version'=>$version])->one(); + $software=Software::find()->where(['id'=>$history->software_id])->one(); + + if (empty($software)) + { + $message="The software for job $jobid could not be found in our system."; + Yii::$app->session->setFlash('danger', "$message"); + return $this->redirect(['software/history']); + } + $software->jobid=$jobid; $uploadedBy=$software->uploaded_by; diff --git a/models/Software.php b/models/Software.php index 3dcd5ef..f7cecb7 100644 --- a/models/Software.php +++ b/models/Software.php @@ -472,7 +472,7 @@ public static function getIOs($software,$fields,$iSystemFolder,$oSystemFolder) { $url="s3://" . $username . '/' . $field->value; } - $path=$software->imountpoint; + $path=$software->imountpoint . '/' . $field->value; $type='DIRECTORY'; } else