diff --git a/components/RoCrateModal.php b/components/RoCrateModal.php index c2a4f4b..d682dd3 100644 --- a/components/RoCrateModal.php +++ b/components/RoCrateModal.php @@ -41,7 +41,7 @@ class ROCrateModal { - public static function addModal($result,$model, $fields, $software, $soft_type) + public static function addModal($jobid) { $software_icon=''; $publication_icon=''; @@ -50,14 +50,32 @@ public static function addModal($result,$model, $fields, $software, $soft_type) $download_icon=''; $required='*'; + $history=RunHistory::find()->where(['jobid'=>$jobid])->one(); + $software_id=$history->software_id; + $public_url=''; $image_url=''; - $history=$result; - $jobid=$history->jobid; + if($history->type=='job') + { + $software=Software::find()->where(['id'=>$software_id])->one(); + $soft_type='Software'; + $fields=SoftwareInput::find()->where(['softwareid'=>$software_id])->orderBy(['position'=> SORT_ASC])->all(); + $fields=Software::getRerunFieldValues($jobid,$fields); + } + elseif ($history->type=='workflow') + { + $workflow=Workflow::find()->where(['id'=>$software_id])->one(); + $soft_type='Workflow'; + $fields=WorkflowInput::find()->where(['workflow_id'=>$software_id])->orderBy(['position'=> SORT_ASC])->all(); + $fields=Workflow::getRerunFieldValues($jobid,$fields); + + } - $software_id=$history->software_id; + + $model=RoCrate::find()->where(['jobid'=>$jobid])->one(); + //print_r($history->jobid); $disabled_fields=false; if(!empty($model)) { diff --git a/controllers/SoftwareController.php b/controllers/SoftwareController.php index 07ccf97..4749d22 100644 --- a/controllers/SoftwareController.php +++ b/controllers/SoftwareController.php @@ -1053,10 +1053,6 @@ public function actionHistory($crate_id='') $user=User::getCurrentUser()['username']; - - - - // $inactiveJobs=Software::getInactiveJobs(); // print_r($inactiveJobs); // exit(0); @@ -1076,44 +1072,8 @@ public function actionHistory($crate_id='') ->limit($pagination->limit) ->all(); - $rocrates=[]; - $softwares=[]; - $field_matrix=[]; - $soft_types=[]; - $job_ids=array_column($results, 'jobid'); - - - foreach ($results as $result) - { - if($result->type=='job') - { - $software=Software::find()->where(['id'=>$result->software_id])->one(); - $soft_type='Software'; - $fields=SoftwareInput::find()->where(['softwareid'=>$result->software_id])->orderBy(['position'=> SORT_ASC])->all(); - $fields=Software::getRerunFieldValues($result->jobid,$fields); - - - } - elseif ($result->type=='workflow') - { - $workflow=Workflow::find()->where(['id'=>$result->software_id])->one(); - $soft_type='Workflow'; - $fields=WorkflowInput::find()->where(['workflow_id'=>$result->software_id])->orderBy(['position'=> SORT_ASC])->all(); - $fields=Workflow::getRerunFieldValues($result->jobid,$fields); - } - - if ($result->type=='job' || $result->type=='workflow') - { - - $rocrates[$result->jobid]=RoCrate::find()->where(['jobid'=>$result->jobid])->one(); - $softwares[$result->jobid]=$software; - $field_matrix[$result->jobid]=$fields; - $soft_types[$result->jobid]=$soft_type; - } - - } - - return $this->render('history',['results'=>$results,'pagination'=>$pagination,'available'=>$available,'available_workflows'=>$available_workflows,'crate_id'=>$crate_id, 'rocrates'=>$rocrates, 'softwares'=>$softwares, 'field_matrix'=>$field_matrix, 'soft_types'=>$soft_types]); + + return $this->render('history',['results'=>$results,'pagination'=>$pagination,'available'=>$available,'available_workflows'=>$available_workflows,'crate_id'=>$crate_id]); } public function actionRerun($jobid) @@ -1238,9 +1198,6 @@ public function actionRerun($jobid) ->count(); $type=1; - - - return $this->render('run', ['form_params'=>$form_params, 'name'=>$name, 'version'=>$version, 'jobid'=>'', 'errors'=>'', 'runErrors'=>'', 'podid'=>'', 'machineType'=>'', diff --git a/models/RunHistory.php b/models/RunHistory.php index 012f37d..bd57b34 100644 --- a/models/RunHistory.php +++ b/models/RunHistory.php @@ -25,8 +25,6 @@ use Yii; use yii\db\Query; - - /** * This is the model class for table "run_history". * @@ -47,7 +45,6 @@ */ class RunHistory extends \yii\db\ActiveRecord { - public $rocrate_fields=[]; /** * {@inheritdoc} */ diff --git a/scheduler_files/classifier.py b/scheduler_files/classifier.py index 32d6ad0..14916e5 100755 --- a/scheduler_files/classifier.py +++ b/scheduler_files/classifier.py @@ -30,9 +30,6 @@ from sklearn import preprocessing from sklearn.preprocessing import MinMaxScaler from sklearn import svm -from sklearn.feature_selection import VarianceThreshold -from sklearn.feature_selection import SelectKBest -from sklearn.feature_selection import chi2 import csv import sys @@ -103,7 +100,7 @@ if has_header: next(reader) - print("=> Reading samples file ("+bsamples_file.name+")") + print("=> Reading benign samples file ("+bsamples_file.name+")") bsamples_read = 0 for bsample in bsamples_it: if len(bsample)!=0: #avoid empty lines (separators between different benchmarks) @@ -157,9 +154,7 @@ print("=> Normalizing inputs...") min_max_scaler = preprocessing.MinMaxScaler() X = min_max_scaler.fit_transform(X) -# X= SelectKBest(chi2, k=1).fit_transform(X, y) print("\t- Done.") -print(X) # data set split print("=> Splitting dataset...") @@ -168,7 +163,7 @@ # selecting classification method -class_approaches=["log_regression", "log_regression_cs","svm","random_forest", "random_forest_cs"] +class_approaches=["log_regression", "log_regression_cs", "random_forest", "random_forest_cs", "svm"] # # grid search for optimal hyperparameters @@ -181,7 +176,7 @@ if class_approach == "log_regression" or class_approach == "log_regression_cs": # logistic regression / logistic regression cost sensitive # params for cross-validation tuned_parameters = { - "max_iter": [2000,3000,10000], + "max_iter": [60, 80, 100, 120, 140, 160, 180, 200, 220, 240], "solver": ['newton-cg', 'lbfgs', 'liblinear', 'sag', 'saga'] } # determine classifier @@ -227,12 +222,7 @@ best_params[i]=clf.best_params_ best_scores[i]=clf.best_score_ - predictions=clf.predict(testX) i=i+1 - -for row_index, (input, prediction, label) in enumerate(zip (testX, predictions, testy)): - if prediction != label: - print('Row', row_index, 'has been classified as ', prediction, 'and should be ', label) best_score=0 best_clf='' diff --git a/scheduler_files/node-selector.py b/scheduler_files/node-selector.py index 0196432..36c9f55 100755 --- a/scheduler_files/node-selector.py +++ b/scheduler_files/node-selector.py @@ -81,9 +81,9 @@ X_std = (X - scaler['min']) / (scaler['max'] - scaler['min']) X= X_std * (1 - 0) + 0 - result=model.predict(X) nodeType=classes[result[0]] + print(nodeType) diff --git a/views/software/history.php b/views/software/history.php index 3f6e7b3..739ef36 100644 --- a/views/software/history.php +++ b/views/software/history.php @@ -33,11 +33,9 @@ use app\components\Headers; use app\components\RoCrateModal; use app\models\RoCrate; -use app\components\SoftIndexButton; $this->title="Job history"; -echo Html::cssFile('@web/css/software/history.css'); $this->registerJsFile('@web/js/software/history.js', ['depends' => [\yii\web\JqueryAsset::className()]]); /* * Users are able to view the name, version, start date, end date, mountpoint @@ -104,7 +102,7 @@ */ $play_icon=''; -$experiment_icon=''; +$experiment_icon=''; $details_icon=''; @@ -113,11 +111,11 @@ { if ($res->status=='Complete') { - $completed=true; + $completed=''; } else { - $completed=false; + $completed='hidden'; } $key=$res['software_id']; ?> @@ -167,33 +165,32 @@ status)) { - ?> - $res->jobid],['class'=>'btn btn-run', 'title'=>'Re-attach' ])?> - $res->jobid],['class'=>'btn btn-details', 'title'=>'Details'])?> + $res->jobid],['class'=>'btn btn-success btn-md', 'title'=>'Re-attach' ])?> + $res->jobid],['class'=>'btn btn-secondary btn-md', 'title'=>'Details'])?> $res->jobid], - ['class'=>'btn btn-run', 'title'=>'Re-run'])?> - $res->jobid],['class'=>'btn btn-details', 'title'=>'Details'])?> + ['class'=>'btn btn-success btn-md', 'title'=>'Re-run'])?> + $res->jobid],['class'=>'btn btn-secondary btn-md', 'title'=>'Details'])?> jobid]; - - if (!empty($experiment) && $completed) + $experiment=RoCrate::find()->where(['jobid'=>$res->jobid])->one(); + if (!empty($experiment)) { - echo Html::a("$experiment_icon", null, - ['class'=>"btn btn-experiment-exists experiment", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>'Edit the RO-crate object of this run', 'id'=>"$res->jobid", ]); + $experiment_icon=''; + $title='Edit the RO-crate object of this run'; } - elseif (empty($experiment) && $completed) + else { - echo Html::a("$experiment_icon", null, - ['class'=>"btn btn-experiment-new experiment", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>'Save the run in an RO-crate object, to facilitate the reproducibility of the corresponding experiment', 'id'=>"$res->jobid", ]); + $experiment_icon=''; + $title='Save the run in an RO-crate object, to facilitate the reproducibility of the corresponding experiment'; } ?> - + "btn btn-secondary btn-md experiment $completed", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>"$title", 'id'=>"$res->jobid", ])?> @@ -222,8 +219,8 @@ if (empty($res->status)) { ?> - $res->jobid],['class'=>'btn btn-run', 'title'=>'Re-attach'])?> - $res->jobid],['class'=>'btn btn-details', 'title'=>'Details'])?> + $res->jobid],['class'=>'btn btn-success btn-md', 'title'=>'Re-attach'])?> + $res->jobid],['class'=>'btn btn-secondary btn-md', 'title'=>'Details'])?> $res->jobid], - ['class'=>'btn btn-run', 'title'=>'Re-run'])?> - $res->jobid],['class'=>' btn btn-details', 'title'=>'Details'])?> + ['class'=>'btn btn-success btn-md', 'title'=>'Re-run'])?> + $res->jobid],['class'=>' btn btn-secondary btn-md', 'title'=>'Details'])?> jobid]; - - if (!empty($experiment) && $completed) + $experiment=RoCrate::find()->where(['jobid'=>$res->jobid])->one(); + if (!empty($experiment)) { - echo Html::a("$experiment_icon", null, - ['class'=>"btn btn-experiment-exists experiment", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>'Edit the RO-crate object of this run', 'id'=>"$res->jobid", ]); + $experiment_icon=''; + $title='Edit the RO-crate object of this run'; } - elseif (empty($experiment) && $completed) + else { - echo Html::a("$experiment_icon", null, - ['class'=>"btn btn-experiment-new experiment", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>'Save the run in an RO-crate object, to facilitate the reproducibility of the corresponding experiment', 'id'=>"$res->jobid", ]); + $experiment_icon=''; + $title='Save the run in an RO-crate object, to facilitate the reproducibility of the corresponding experiment'; } ?> - + "btn btn-secondary btn-md experiment $completed", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>"$title", 'id'=>"$res->jobid", ])?> @@ -287,14 +283,9 @@ type=='job' || $result->type=='workflow') { - $software=$softwares[$result->jobid]; - $soft_type=$soft_types[$result->jobid]; - $model=$rocrates[$result->jobid]; - $fields=$field_matrix[$result->jobid]; - RoCrateModal::addModal($result, $model, $fields, $software, $soft_type); + RoCrateModal::addModal($result->jobid); } } diff --git a/web/css/software/history.css b/web/css/software/history.css deleted file mode 100644 index f3b7cca..0000000 --- a/web/css/software/history.css +++ /dev/null @@ -1,12 +0,0 @@ -.btn-run, .btn-experiment-exists -{ - font-size: 16px !important; - color: green !important; -} - -.btn-details, .btn-experiment-new -{ - font-size: 16px !important; - color: #6c757d !important; -} -