Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 3783a6d

Browse files
committed
Adding reproduction command to tracker scalars.
1 parent eaf57a0 commit 3783a6d

File tree

8 files changed

+324
-3
lines changed

8 files changed

+324
-3
lines changed

modules/tracker/configs/module.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ description = "Track scalar results over time"
66
category = "Visualization"
77
dependencies = api,scheduler
88
uuid = "3048a9fa-89ab-4e61-a55e-a49379fa6dc"
9-
version = "1.2.2"
9+
version = "1.2.3"

modules/tracker/controllers/components/ApiComponent.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public function itemAssociate($args)
128128
* @param silent (Optional) If set, do not perform threshold-based email notifications for this scalar
129129
* @param unofficial (Optional) If passed, creates an unofficial scalar visible only to the user performing the submission
130130
* @param unit (Optional) If passed, the unit of the scalar value that identifies which trend this point belongs to.
131+
* @param reproductionCommand (Optional) If passed, the command to produce this scalar
131132
* @return The scalar DAO that was created
132133
* @throws Exception
133134
*/
@@ -280,6 +281,11 @@ public function scalarAdd($args)
280281
$submissionId = $submissionDao->getKey();
281282
}
282283

284+
$reproductionCommand = null;
285+
if (isset($args['reproductionCommand'])) {
286+
$reproductionCommand = $args['reproductionCommand'];
287+
}
288+
283289
/** @var Tracker_ScalarModel $scalarModel */
284290
$scalarModel = MidasLoader::loadModel('Scalar', 'tracker');
285291
$scalar = $scalarModel->addToTrend(
@@ -294,7 +300,8 @@ public function scalarAdd($args)
294300
$buildResultsUrl,
295301
$branch,
296302
$extraParams,
297-
$extraUrls
303+
$extraUrls,
304+
$reproductionCommand
298305
);
299306

300307
if (!isset($args['silent'])) {
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
-- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
2+
3+
-- MySQL database for the tracker module, version 1.2.2
4+
5+
CREATE TABLE IF NOT EXISTS `tracker_producer` (
6+
`producer_id` bigint(20) NOT NULL AUTO_INCREMENT,
7+
`community_id` bigint(20) NOT NULL,
8+
`repository` varchar(255) NOT NULL,
9+
`executable_name` varchar(255) NOT NULL,
10+
`display_name` varchar(255) NOT NULL,
11+
`description` text NOT NULL,
12+
`revision_url` text NOT NULL,
13+
PRIMARY KEY (`producer_id`),
14+
KEY (`community_id`)
15+
) DEFAULT CHARSET=utf8;
16+
17+
CREATE TABLE IF NOT EXISTS `tracker_scalar` (
18+
`scalar_id` bigint(20) NOT NULL AUTO_INCREMENT,
19+
`trend_id` bigint(20) NOT NULL,
20+
`value` double,
21+
`producer_revision` varchar(255),
22+
`submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
23+
`user_id` bigint(20) NOT NULL DEFAULT '-1',
24+
`submission_id` bigint(20) NOT NULL DEFAULT '-1',
25+
`official` tinyint(4) NOT NULL DEFAULT '1',
26+
`build_results_url` text NOT NULL,
27+
`branch` varchar(255) NOT NULL DEFAULT '',
28+
`extra_urls` text,
29+
`reproduction_command` text,
30+
PRIMARY KEY (`scalar_id`),
31+
KEY (`trend_id`),
32+
KEY (`submit_time`),
33+
KEY (`user_id`),
34+
KEY (`submission_id`),
35+
KEY (`branch`)
36+
) DEFAULT CHARSET=utf8;
37+
38+
CREATE TABLE IF NOT EXISTS `tracker_submission` (
39+
`submission_id` bigint(20) NOT NULL AUTO_INCREMENT,
40+
`producer_id` bigint(20) NOT NULL,
41+
`name` varchar(255) NOT NULL DEFAULT '',
42+
`uuid` varchar(255) NOT NULL DEFAULT '',
43+
`submit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
44+
PRIMARY KEY (`submission_id`),
45+
UNIQUE KEY (`uuid`)
46+
) DEFAULT CHARSET=utf8;
47+
48+
CREATE TABLE IF NOT EXISTS `tracker_scalar2item` (
49+
`scalar_id` bigint(20) NOT NULL,
50+
`item_id` bigint(20) NOT NULL,
51+
`label` varchar(255) NOT NULL,
52+
KEY (`scalar_id`)
53+
) DEFAULT CHARSET=utf8;
54+
55+
CREATE TABLE IF NOT EXISTS `tracker_threshold_notification` (
56+
`threshold_id` bigint(20) NOT NULL AUTO_INCREMENT,
57+
`trend_id` bigint(20) NOT NULL,
58+
`value` double,
59+
`comparison` varchar(2),
60+
`action` varchar(80) NOT NULL,
61+
`recipient_id` bigint(20) NOT NULL,
62+
PRIMARY KEY (`threshold_id`),
63+
KEY (`trend_id`)
64+
) DEFAULT CHARSET=utf8;
65+
66+
CREATE TABLE IF NOT EXISTS `tracker_trend` (
67+
`trend_id` bigint(20) NOT NULL AUTO_INCREMENT,
68+
`producer_id` bigint(20) NOT NULL,
69+
`metric_name` varchar(255) NOT NULL,
70+
`display_name` varchar(255) NOT NULL,
71+
`unit` varchar(255) NOT NULL,
72+
`config_item_id` bigint(20),
73+
`test_dataset_id` bigint(20),
74+
`truth_dataset_id` bigint(20),
75+
`key_metric` tinyint(4) NOT NULL DEFAULT '0',
76+
PRIMARY KEY (`trend_id`),
77+
KEY (`producer_id`)
78+
) DEFAULT CHARSET=utf8;
79+
80+
CREATE TABLE IF NOT EXISTS `tracker_param` (
81+
`param_id` bigint(20) NOT NULL AUTO_INCREMENT,
82+
`scalar_id` bigint(20) NOT NULL,
83+
`param_name` varchar(255) NOT NULL,
84+
`param_type` enum('text', 'numeric') NOT NULL,
85+
`text_value` text,
86+
`numeric_value` double,
87+
PRIMARY KEY (`param_id`),
88+
KEY (`param_name`)
89+
) DEFAULT CHARSET=utf8;
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
-- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
2+
3+
-- PostgreSQL database for the tracker module, version 1.2.2
4+
5+
SET client_encoding = 'UTF8';
6+
SET default_with_oids = FALSE;
7+
8+
CREATE TABLE IF NOT EXISTS "tracker_producer" (
9+
"producer_id" serial PRIMARY KEY,
10+
"community_id" bigint NOT NULL,
11+
"repository" character varying(255) NOT NULL,
12+
"executable_name" character varying(255) NOT NULL,
13+
"display_name" character varying(255) NOT NULL,
14+
"description" text NOT NULL,
15+
"revision_url" text NOT NULL
16+
);
17+
18+
CREATE INDEX "tracker_producer_community_id" ON "tracker_producer" ("community_id");
19+
20+
CREATE TABLE IF NOT EXISTS "tracker_scalar" (
21+
"scalar_id" serial PRIMARY KEY,
22+
"trend_id" bigint NOT NULL,
23+
"value" double precision,
24+
"producer_revision" character varying(255),
25+
"submit_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
26+
"user_id" bigint NOT NULL DEFAULT -1::bigint,
27+
"submission_id" bigint NOT NULL DEFAULT -1::bigint,
28+
"official" smallint NOT NULL DEFAULT 1::smallint,
29+
"build_results_url" text NOT NULL,
30+
"branch" character varying(255) NOT NULL DEFAULT ''::character varying,
31+
"extra_urls" text,
32+
"reproduction_command" text
33+
);
34+
35+
CREATE INDEX "tracker_scalar_trend_id" ON "tracker_scalar" ("trend_id");
36+
CREATE INDEX "tracker_scalar_submit_time" ON "tracker_scalar" ("submit_time");
37+
CREATE INDEX "tracker_scalar_idx_branch" ON "tracker_scalar" ("branch");
38+
CREATE INDEX "tracker_scalar_idx_user_id" ON "tracker_scalar" ("user_id");
39+
40+
CREATE TABLE IF NOT EXISTS "tracker_submission" (
41+
"submission_id" serial PRIMARY KEY,
42+
"producer_id" bigint,
43+
"name" character varying(255) NOT NULL DEFAULT ''::character varying,
44+
"uuid" character varying(255) NOT NULL DEFAULT ''::character varying,
45+
"submit_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
46+
);
47+
CREATE UNIQUE INDEX "tracker_submission_uuid" ON "tracker_submission" ("uuid");
48+
CREATE INDEX "tracker_submission_submit_time" ON "tracker_submission" ("submit_time");
49+
50+
CREATE TABLE IF NOT EXISTS "tracker_scalar2item" (
51+
"id" serial PRIMARY KEY,
52+
"scalar_id" bigint NOT NULL,
53+
"item_id" bigint NOT NULL,
54+
"label" character varying(255) NOT NULL
55+
);
56+
57+
CREATE INDEX "tracker_scalar2item_scalar_id" ON "tracker_scalar2item" ("scalar_id");
58+
59+
CREATE TABLE IF NOT EXISTS "tracker_threshold_notification" (
60+
"threshold_id" serial PRIMARY KEY,
61+
"trend_id" bigint NOT NULL,
62+
"value" double precision,
63+
"comparison" character varying(2),
64+
"action" character varying(80) NOT NULL,
65+
"recipient_id" bigint NOT NULL
66+
);
67+
68+
CREATE INDEX "tracker_threshold_notification_trend_id" ON "tracker_threshold_notification" ("trend_id");
69+
70+
CREATE TABLE IF NOT EXISTS "tracker_trend" (
71+
"trend_id" serial PRIMARY KEY,
72+
"producer_id" bigint NOT NULL,
73+
"metric_name" character varying(255) NOT NULL,
74+
"display_name" character varying(255) NOT NULL,
75+
"unit" character varying(255) NOT NULL,
76+
"config_item_id" bigint,
77+
"test_dataset_id" bigint,
78+
"truth_dataset_id" bigint,
79+
"key_metric" smallint NOT NULL DEFAULT 0::smallint
80+
);
81+
82+
CREATE INDEX "tracker_trend_producer_id" ON "tracker_trend" ("producer_id");
83+
84+
CREATE TABLE IF NOT EXISTS "tracker_param" (
85+
"param_id" serial PRIMARY KEY,
86+
"scalar_id" bigint NOT NULL,
87+
"param_name" character varying(255) NOT NULL,
88+
"param_type" text CHECK (param_type IN ('text', 'numeric')),
89+
"text_value" text,
90+
"numeric_value" double precision);
91+
);
92+
93+
CREATE INDEX "tracker_param_param_name_idx" ON "tracker_param" ("param_name");
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
-- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
2+
3+
-- SQLite database for the tracker module, version 1.2.2
4+
5+
CREATE TABLE IF NOT EXISTS "tracker_producer" (
6+
"producer_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
7+
"community_id" INTEGER NOT NULL,
8+
"repository" TEXT NOT NULL,
9+
"executable_name" TEXT NOT NULL,
10+
"display_name" TEXT NOT NULL,
11+
"description" TEXT NOT NULL,
12+
"revision_url" TEXT NOT NULL
13+
);
14+
15+
CREATE INDEX IF NOT EXISTS "tracker_producer_community_id_idx" ON "tracker_producer" ("community_id");
16+
17+
CREATE TABLE IF NOT EXISTS "tracker_scalar" (
18+
"scalar_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
19+
"trend_id" INTEGER NOT NULL,
20+
"value" REAL,
21+
"producer_revision" TEXT,
22+
"submit_time" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
23+
"user_id" INTEGER NOT NULL DEFAULT -1,
24+
"submission_id" INTEGER NOT NULL DEFAULT -1,
25+
"official" INTEGER NOT NULL DEFAULT 1,
26+
"build_results_url" TEXT NOT NULL,
27+
"branch" TEXT NOT NULL DEFAULT '',
28+
"extra_urls" TEXT,
29+
"reproduction_command" TEXT
30+
);
31+
32+
CREATE INDEX IF NOT EXISTS "tracker_scalar_trend_id_idx" ON "tracker_scalar" ("trend_id");
33+
CREATE INDEX IF NOT EXISTS "tracker_scalar_submit_time_idx" ON "tracker_scalar" ("submit_time");
34+
CREATE INDEX IF NOT EXISTS "tracker_scalar_branch_idx" ON "tracker_scalar" ("branch");
35+
CREATE INDEX IF NOT EXISTS "tracker_scalar_user_id_idx" ON "tracker_scalar" ("user_id");
36+
37+
38+
CREATE TABLE IF NOT EXISTS "tracker_submission" (
39+
"submission_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
40+
"producer_id" INTEGER NOT NULL,
41+
"name" TEXT NOT NULL DEFAULT '',
42+
"uuid" TEXT NOT NULL DEFAULT '',
43+
"submit_time" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
44+
);
45+
CREATE UNIQUE INDEX IF NOT EXISTS "tracker_submission_uuid_idx" ON "tracker_submission" ("uuid");
46+
CREATE INDEX IF NOT EXISTS "tracker_submission_submit_time_idx" ON "tracker_submission" ("submit_time");
47+
48+
49+
CREATE TABLE IF NOT EXISTS "tracker_scalar2item" (
50+
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
51+
"scalar_id" INTEGER NOT NULL,
52+
"item_id" INTEGER NOT NULL,
53+
"label" TEXT NOT NULL
54+
);
55+
56+
CREATE INDEX IF NOT EXISTS "tracker_scalar2item_scalar_id_idx" ON "tracker_scalar2item" ("scalar_id");
57+
58+
CREATE TABLE IF NOT EXISTS "tracker_threshold_notification" (
59+
"threshold_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
60+
"trend_id" INTEGER NOT NULL,
61+
"value" REAL,
62+
"comparison" TEXT,
63+
"action" TEXT NOT NULL,
64+
"recipient_id" INTEGER NOT NULL
65+
);
66+
67+
CREATE INDEX IF NOT EXISTS "tracker_threshold_notification_trend_id_idx" ON "tracker_threshold_notification" ("trend_id");
68+
69+
CREATE TABLE IF NOT EXISTS "tracker_trend" (
70+
"trend_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
71+
"producer_id" INTEGER NOT NULL,
72+
"metric_name" TEXT NOT NULL,
73+
"display_name" TEXT NOT NULL,
74+
"unit" TEXT NOT NULL,
75+
"config_item_id" INTEGER,
76+
"test_dataset_id" INTEGER,
77+
"truth_dataset_id" INTEGER,
78+
"key_metric" INTEGER NOT NULL DEFAULT 0
79+
);
80+
81+
CREATE INDEX IF NOT EXISTS "tracker_trend_producer_id_idx" ON "tracker_trend" ("producer_id");
82+
83+
CREATE TABLE IF NOT EXISTS "tracker_param" (
84+
"param_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
85+
"scalar_id" INTEGER NOT NULL,
86+
"param_name" TEXT NOT NULL,
87+
"param_type" TEXT CHECK( param_type in ('text', 'numeric') ) NOT NULL,
88+
"text_value" text,
89+
"numeric_value" REAL
90+
);
91+
CREATE INDEX IF NOT EXISTS "tracker_param_param_name" ON "tracker_param" ("param_name");
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/*=========================================================================
3+
Midas Server
4+
Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France.
5+
All rights reserved.
6+
For more information visit http://www.kitware.com/.
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0.txt
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
=========================================================================*/
20+
21+
/** Upgrade the tracker module to version 1.2.3. */
22+
class Tracker_Upgrade_1_2_3 extends MIDASUpgrade
23+
{
24+
/** Upgrade a MySQL database. */
25+
public function mysql()
26+
{
27+
$this->db->query('ALTER TABLE `tracker_scalar` ADD COLUMN `reproduction_command` text;');
28+
}
29+
30+
/** Upgrade a PostgreSQL database. */
31+
public function pgsql()
32+
{
33+
$this->db->query('ALTER TABLE tracker_scalar ADD COLUMN reproduction_command text;');
34+
}
35+
}

modules/tracker/models/base/ScalarModelBase.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct()
4040
'submit_time' => array('type' => MIDAS_DATA),
4141
'value' => array('type' => MIDAS_DATA),
4242
'producer_revision' => array('type' => MIDAS_DATA),
43+
'reproduction_command' => array('type' => MIDAS_DATA),
4344
'trend' => array(
4445
'type' => MIDAS_MANY_TO_ONE,
4546
'model' => 'Trend',
@@ -137,6 +138,7 @@ abstract public function getDistinctBranches();
137138
* @param null|string $branch branch name
138139
* @param null|string|array $params parameters
139140
* @param null|string|array $extraUrls extra URLs
141+
* @param null|string $reproductionCommand the command to reproduce this run
140142
* @return Tracker_ScalarDao scalar DAO
141143
*/
142144
public function addToTrend(
@@ -151,7 +153,8 @@ public function addToTrend(
151153
$buildResultsUrl = '',
152154
$branch = '',
153155
$params = null,
154-
$extraUrls = null
156+
$extraUrls = null,
157+
$reproductionCommand = null
155158
) {
156159
if ($overwrite === true) {
157160
$scalarDao = $this->getByTrendAndTimestamp($trendDao->getKey(), $submitTime, $userDao->getKey());
@@ -181,6 +184,7 @@ public function addToTrend(
181184
$scalarDao->setBuildResultsUrl($buildResultsUrl);
182185
$scalarDao->setBranch(trim($branch));
183186
$scalarDao->setExtraUrls($extraUrls);
187+
$scalarDao->setReproductionCommand($reproductionCommand);
184188
$this->save($scalarDao);
185189

186190
if (!empty($params) && is_array($params)) {

modules/tracker/models/dao/ScalarDao.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
* @method void setTrend(Tracker_TrendDao $trendDao)
5050
* @method UserDao getUser()
5151
* @method void setUser(UserDao $userDao)
52+
* @method string getReproductionCommand()
53+
* @method void setReproductionCommand(string $reproductionCommand)
5254
*/
5355
class Tracker_ScalarDao extends Tracker_AppDao
5456
{

0 commit comments

Comments
 (0)