diff --git a/components/RoCrateModal.php b/components/RoCrateModal.php
index d682dd3..c2a4f4b 100644
--- a/components/RoCrateModal.php
+++ b/components/RoCrateModal.php
@@ -41,7 +41,7 @@
class ROCrateModal
{
- public static function addModal($jobid)
+ public static function addModal($result,$model, $fields, $software, $soft_type)
{
$software_icon='';
$publication_icon='';
@@ -50,32 +50,14 @@ public static function addModal($jobid)
$download_icon='';
$required='*';
- $history=RunHistory::find()->where(['jobid'=>$jobid])->one();
- $software_id=$history->software_id;
-
$public_url='';
$image_url='';
- 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);
-
- }
+ $history=$result;
+ $jobid=$history->jobid;
-
- $model=RoCrate::find()->where(['jobid'=>$jobid])->one();
+ $software_id=$history->software_id;
- //print_r($history->jobid);
$disabled_fields=false;
if(!empty($model))
{
diff --git a/controllers/SoftwareController.php b/controllers/SoftwareController.php
index 4749d22..07ccf97 100644
--- a/controllers/SoftwareController.php
+++ b/controllers/SoftwareController.php
@@ -1053,6 +1053,10 @@ public function actionHistory($crate_id='')
$user=User::getCurrentUser()['username'];
+
+
+
+
// $inactiveJobs=Software::getInactiveJobs();
// print_r($inactiveJobs);
// exit(0);
@@ -1072,8 +1076,44 @@ public function actionHistory($crate_id='')
->limit($pagination->limit)
->all();
-
- return $this->render('history',['results'=>$results,'pagination'=>$pagination,'available'=>$available,'available_workflows'=>$available_workflows,'crate_id'=>$crate_id]);
+ $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]);
}
public function actionRerun($jobid)
@@ -1198,6 +1238,9 @@ 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 bd57b34..012f37d 100644
--- a/models/RunHistory.php
+++ b/models/RunHistory.php
@@ -25,6 +25,8 @@
use Yii;
use yii\db\Query;
+
+
/**
* This is the model class for table "run_history".
*
@@ -45,6 +47,7 @@
*/
class RunHistory extends \yii\db\ActiveRecord
{
+ public $rocrate_fields=[];
/**
* {@inheritdoc}
*/
diff --git a/scheduler_files/classifier.py b/scheduler_files/classifier.py
index 14916e5..32d6ad0 100755
--- a/scheduler_files/classifier.py
+++ b/scheduler_files/classifier.py
@@ -30,6 +30,9 @@
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
@@ -100,7 +103,7 @@
if has_header:
next(reader)
- print("=> Reading benign samples file ("+bsamples_file.name+")")
+ print("=> Reading samples file ("+bsamples_file.name+")")
bsamples_read = 0
for bsample in bsamples_it:
if len(bsample)!=0: #avoid empty lines (separators between different benchmarks)
@@ -154,7 +157,9 @@
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...")
@@ -163,7 +168,7 @@
# selecting classification method
-class_approaches=["log_regression", "log_regression_cs", "random_forest", "random_forest_cs", "svm"]
+class_approaches=["log_regression", "log_regression_cs","svm","random_forest", "random_forest_cs"]
# # grid search for optimal hyperparameters
@@ -176,7 +181,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": [60, 80, 100, 120, 140, 160, 180, 200, 220, 240],
+ "max_iter": [2000,3000,10000],
"solver": ['newton-cg', 'lbfgs', 'liblinear', 'sag', 'saga']
}
# determine classifier
@@ -222,7 +227,12 @@
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 36c9f55..0196432 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 739ef36..3f6e7b3 100644
--- a/views/software/history.php
+++ b/views/software/history.php
@@ -33,9 +33,11 @@
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
@@ -102,7 +104,7 @@
*/
$play_icon='';
-$experiment_icon='';
+$experiment_icon='';
$details_icon='';
@@ -111,11 +113,11 @@
{
if ($res->status=='Complete')
{
- $completed='';
+ $completed=true;
}
else
{
- $completed='hidden';
+ $completed=false;
}
$key=$res['software_id'];
?>
@@ -165,32 +167,33 @@
status))
{
+
?>
- = Html::a("$play_icon",[$controller . '/reattach','jobid'=>$res->jobid],['class'=>'btn btn-success btn-md', 'title'=>'Re-attach' ])?>
- = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>'btn btn-secondary btn-md', 'title'=>'Details'])?>
+ = Html::a("$play_icon",[$controller . '/reattach','jobid'=>$res->jobid],['class'=>'btn btn-run', 'title'=>'Re-attach' ])?>
+ = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>'btn btn-details', 'title'=>'Details'])?>
= Html::a("$play_icon",[$controller . '/rerun','jobid'=>$res->jobid],
- ['class'=>'btn btn-success btn-md', 'title'=>'Re-run'])?>
- = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>'btn btn-secondary btn-md', 'title'=>'Details'])?>
+ ['class'=>'btn btn-run', 'title'=>'Re-run'])?>
+ = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>'btn btn-details', 'title'=>'Details'])?>
where(['jobid'=>$res->jobid])->one();
- if (!empty($experiment))
+ $experiment=$rocrates[$res->jobid];
+
+ if (!empty($experiment) && $completed)
{
- $experiment_icon='';
- $title='Edit the RO-crate object of this run';
+ 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", ]);
}
- else
+ elseif (empty($experiment) && $completed)
{
- $experiment_icon='';
- $title='Save the run in an RO-crate object, to facilitate the reproducibility of the corresponding experiment';
+ 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", ]);
}
?>
- = Html::a("$experiment_icon", null,
- ['class'=>"btn btn-secondary btn-md experiment $completed", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>"$title", 'id'=>"$res->jobid", ])?>
+
@@ -219,8 +222,8 @@
if (empty($res->status))
{
?>
- = Html::a("$play_icon",['workflow/reattach','jobid'=>$res->jobid],['class'=>'btn btn-success btn-md', 'title'=>'Re-attach'])?>
- = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>'btn btn-secondary btn-md', 'title'=>'Details'])?>
+ = Html::a("$play_icon",['workflow/reattach','jobid'=>$res->jobid],['class'=>'btn btn-run', 'title'=>'Re-attach'])?>
+ = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>'btn btn-details', 'title'=>'Details'])?>
= Html::a("$play_icon",['workflow/rerun','jobid'=>$res->jobid],
- ['class'=>'btn btn-success btn-md', 'title'=>'Re-run'])?>
- = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>' btn btn-secondary btn-md', 'title'=>'Details'])?>
+ ['class'=>'btn btn-run', 'title'=>'Re-run'])?>
+ = Html::a("$details_icon",['software/job-details', 'jobid'=>$res->jobid],['class'=>' btn btn-details', 'title'=>'Details'])?>
where(['jobid'=>$res->jobid])->one();
- if (!empty($experiment))
+
+ $experiment=$rocrates[$res->jobid];
+
+ if (!empty($experiment) && $completed)
{
- $experiment_icon='';
- $title='Edit the RO-crate object of this run';
+ 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", ]);
}
- else
+ elseif (empty($experiment) && $completed)
{
- $experiment_icon='';
- $title='Save the run in an RO-crate object, to facilitate the reproducibility of the corresponding experiment';
+ 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", ]);
}
?>
- = Html::a("$experiment_icon", null,
- ['class'=>"btn btn-secondary btn-md experiment $completed", 'data-target'=>"#experiment-modal-$res->jobid", 'title'=>"$title", 'id'=>"$res->jobid", ])?>
+
@@ -283,9 +287,14 @@
type=='job' || $result->type=='workflow')
{
- RoCrateModal::addModal($result->jobid);
+ $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);
}
}
diff --git a/web/css/software/history.css b/web/css/software/history.css
new file mode 100644
index 0000000..f3b7cca
--- /dev/null
+++ b/web/css/software/history.css
@@ -0,0 +1,12 @@
+.btn-run, .btn-experiment-exists
+{
+ font-size: 16px !important;
+ color: green !important;
+}
+
+.btn-details, .btn-experiment-new
+{
+ font-size: 16px !important;
+ color: #6c757d !important;
+}
+