Skip to content

Commit

Permalink
Add extra column to record the 'real' application name for proprietar…
Browse files Browse the repository at this point in the history
…y applications
  • Loading branch information
jpwhite4 committed Jan 19, 2023
1 parent f6753df commit f13d7bc
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 5 deletions.
23 changes: 23 additions & 0 deletions configuration/etl/etl.d/supremm-migration-10_0_0-10_5_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,28 @@
}
},
"migration-10_0_0-10_5_0": [
{
"name": "table-create",
"description": "Setup tables",
"class": "ManageTables",
"namespace": "ETL\\Maintenance",
"options_class": "MaintenanceOptions",
"definition_file_list": [
"supremm/job.json",
"supremm/job_errors.json"
]
},
{
"name": "update-table-contents",
"description": "Update non-etlv2-managed tables and contents",
"namespace": "ETL\\Maintenance",
"options_class": "MaintenanceOptions",
"class": "ExecuteSql",
"sql_file_list": [
{
"sql_file": "supremm/migration-10_0_0-10_5_0.sql"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `modw_supremm`.`executable` ADD COLUMN `real_application_id` int(11) DEFAULT '-1' AFTER `application_id`
//
21 changes: 19 additions & 2 deletions etl/js/config/supremm/dataset_maps/pcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ module.exports = function(config) {
if (job.procDump.constrained.length > 0) {
return {
executable: job.procDump.constrained[0],
name: 'uncategorized'
name: 'uncategorized',
realname: 'uncategorized'
};
}
if (job.procDump.unconstrained.length > 0) {
return {
executable: job.procDump.unconstrained[0],
name: 'uncategorized'
name: 'uncategorized',
realname: 'uncategorized'
};
}
}
Expand Down Expand Up @@ -195,6 +197,21 @@ module.exports = function(config) {
};
}
},
real_application: {
formula: function (job) {
var app = getProcInfo(job);
if (app) {
return {
value: app.realname,
error: 0
};
}
return {
value: null,
error: this.metricErrors.codes.metricMissingUnknownReason.value
};
}
},
"exit_status": {
formula: function(job) {
var exit = this.ref(job, "acct.exit_status");
Expand Down
40 changes: 37 additions & 3 deletions etl/js/config/supremm/etl.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,14 @@ module.exports = {
per: "job",
dim_insert: function(attributes) {
return {
query: "INSERT IGNORE INTO modw_supremm.executable (`resource_id`, `exec`, `binary`, `exec_md5`, `application_id`) " +
"VALUES (:resource_id, :exec, substring_index(:exec,'/',-1), MD5(:exec), COALESCE((SELECT id FROM modw_supremm.application WHERE `name` = :appname), -1) )",
values: {resource_id: attributes.resource_id.value, exec: attributes.executable.value, appname: attributes.application.value}
query: 'INSERT IGNORE INTO modw_supremm.executable (`resource_id`, `exec`, `binary`, `exec_md5`, `application_id`, `real_application_id`) ' +
'VALUES (:resource_id, :exec, substring_index(:exec,\'/\',-1), MD5(:exec), COALESCE((SELECT id FROM modw_supremm.application WHERE `name` = :appname), -1), COALESCE((SELECT id FROM modw_supremm.application WHERE `name` = :real_appname), -1) )',
values: {
resource_id: attributes.resource_id.value,
exec: attributes.executable.value,
appname: attributes.application.value,
real_appname: attributes.real_application.value
}
};
}
},
Expand All @@ -343,6 +348,16 @@ module.exports = {
comments: "The name of the application that ran",
per: "job",
},
real_application: {
unit: null,
type: 'string',
dtype: 'accounting',
group: 'Executable',
nullable: false,
def: 'NA',
comments: 'The actual name of the application that ran.',
per: 'job'
},
exit_status: {
unit: null,
type: "string",
Expand Down Expand Up @@ -2335,6 +2350,11 @@ module.exports = {
table: "modw_supremm.application",
where: "name = :application"
},
real_application: {
mapping: { real_application_id: 'id' },
table: 'modw_supremm.application',
where: 'name = :real_application'
},
cwd: {
mapping: {cwd_id: "id"},
table: "modw_supremm.cwd",
Expand Down Expand Up @@ -2599,6 +2619,20 @@ module.exports = {
table: 'application'
}
},
real_application_id: {
type: 'int32',
nullable: false,
def: null,
group: 'Executable',
comments: 'The actual application.',
per: 'job',
table: 'job',
queries: ['real_application'],
agg: [{
table: 'supremmfact',
dimension: true
}]
},
nodecount_id: {
type: "int32",
nullable: false,
Expand Down
1 change: 1 addition & 0 deletions etl/js/config/supremm/output_db/modw_supremm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ CREATE TABLE `executable` (
`exec_md5` char(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`binary` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`application_id` int(11) DEFAULT '-1',
`real_application_id` int(11) DEFAULT '-1',
PRIMARY KEY (`id`),
UNIQUE KEY `unique` (`exec_md5`,`resource_id`),
KEY `exec_md5` (`exec_md5`,`resource_id`,`id`)
Expand Down
8 changes: 8 additions & 0 deletions tests/integration_tests/scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ checkForColumn netdir_util_write
checkForColumn gpus
checkForColumn gpu_time
checkForColumn gpu_usage
checkForColumn real_application_id

# Check that the catastrophe buckets table has the extra column
if [ -z "$(echo "show columns from modw_supremm.catastrophe_buckets LIKE 'h_description'" | mysql -N modw_supremm)" ];
Expand All @@ -59,6 +60,13 @@ then
exitcode=1
fi

# Check that the executable table has the extra column
if [ -z "$(echo "show columns from modw_supremm.executable LIKE 'real_application_id'" | mysql -N modw_supremm)" ];
then
echo "Missing real_application_id column from modw_supremm.executable table"
exitcode=1
fi

# Check that the jobhosts table has end_time_ts column with non-zero timestamps
jobcount=$(echo 'SELECT COUNT(*) FROM modw_supremm.job j, modw_supremm.jobhost jh WHERE j.resource_id = jh.resource_id AND j.local_job_id = jh.local_job_id AND j.end_time_ts = jh.end_time_ts' | mysql -N modw_supremm)
if [ $jobcount -eq 0 ];
Expand Down

0 comments on commit f13d7bc

Please sign in to comment.