Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding columns for resource, PI, and person organization ID for cloud realm #1936

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Update database from version 11.0.0 to 11.5.0
*/

namespace OpenXdmod\Migration\Version1100To1150;

use OpenXdmod\Migration\DatabasesMigration as AbstractDatabasesMigration;
use CCR\DB;
use CCR\DB\MySQLHelper;
use ETL\Utilities;

/**
* Migrate databases from version 11.0.0 to 11.5.0
*/
class DatabasesMigration extends AbstractDatabasesMigration
{
public function execute()
{
parent::execute();

$dbh = DB::factory('datawarehouse');
$mysql_helper = MySQLHelper::factory($dbh);

if ($mysql_helper->tableExists('modw_cloud.event')) {
Utilities::runEtlPipeline(
['cloud-migration-11-0-0_11-5-0','cloud-state-pipeline'],
$this->logger,
['last-modified-start-date' => '2016-01-01 00:00:00']
);
}
}
}
33 changes: 33 additions & 0 deletions configuration/etl/etl.d/xdmod-migration-11_0_0-11_5_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"module": "xdmod",
"defaults": {
"cloud-migration-11-0-0_11-5-0": {
"namespace": "ETL\\Maintenance",
"options_class": "MaintenanceOptions",
"class": "ManageTables",
"endpoints": {
"destination": {
"type": "mysql",
"name": "Cloud Database",
"config": "database",
"schema": "modw_cloud"
},
"source": {
"type": "mysql",
"name": "Cloud Databaes",
"config": "database",
"schema": "modw_cloud"
}
}
}
},
"cloud-migration-11-0-0_11-5-0": [
{
"name": "AddResourcePIOrganizationID",
"description": "Update instance type union table.",
"definition_file_list": [
"cloud_common/session_records.json"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"host_resource_id": "sr.resource_id",
"account_id": "sr.account_id",
"person_id": "sr.person_id",
"person_organization_id": "sr.person_organization_id",
"systemaccount_id": "sr.systemaccount_id",
"processorbucket_id": "sr.processorbucket_id",
"memorybucket_id": "sr.memorybucket_id",
Expand All @@ -47,6 +48,7 @@
"domain_id": "sr.domain_id",
"service_provider": "sr.service_provider",
"principalinvestigator_person_id": "sr.principalinvestigator_person_id",
"piperson_organization_id": "sr.piperson_organization_id",
"fos_id": "sr.fos_id",
"instance_state_id": "sr.instance_state_id"
},
Expand All @@ -65,8 +67,10 @@
"domain_id",
"service_provider",
"principalinvestigator_person_id",
"piperson_organization_id",
"fos_id",
"person_id",
"person_organization_id",
"instance_state_id"
],
"joins":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"host_resource_id": "sr.resource_id",
"account_id": "sr.account_id",
"person_id": "sr.person_id",
"person_organization_id": "sr.person_organization_id",
"systemaccount_id": "sr.systemaccount_id",
"processorbucket_id": "sr.processorbucket_id",
"memorybucket_id": "sr.memorybucket_id",
Expand All @@ -47,6 +48,7 @@
"domain_id": "sr.domain_id",
"service_provider": "sr.service_provider",
"principalinvestigator_person_id": "sr.principalinvestigator_person_id",
"piperson_organization_id": "sr.piperson_organization_id",
"fos_id": "sr.fos_id",
"instance_state_id": "sr.instance_state_id",
"session_id_list": "GROUP_CONCAT(sr.session_id)"
Expand All @@ -66,8 +68,10 @@
"domain_id",
"service_provider",
"principalinvestigator_person_id",
"piperson_organization_id",
"fos_id",
"person_id",
"person_organization_id",
"instance_state_id"
],
"joins":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
"end_day_id": "YEAR(FROM_UNIXTIME(e.end_time_ts)) * 100000 + DAYOFYEAR(FROM_UNIXTIME(e.end_time_ts))",
"wallduration": "FLOOR(e.end_time_ts) - FLOOR(e.start_time_ts)",
"person_id": "ev.person_id",
"person_organization_id": "p.organization_id",
"systemaccount_id": "ev.systemaccount_id",
"submission_venue_id": "ev.submission_venue_id",
"domain_id": "ev.domain_id",
"service_provider": "ev.service_provider",
"account_id": "a.account_id",
"principalinvestigator_person_id": "a.principalinvestigator_person_id",
"piperson_organization_id": "pi.organization_id",
"fos_id": "a.fos_id",
"host_id": "ev.host_id",
"instance_state_id": "etype.instance_state_id"
Expand Down Expand Up @@ -75,6 +77,27 @@
"schema": "${SOURCE_SCHEMA}",
"alias": "etype",
"on": "e.start_event_id = etype.event_type_id"
},
{
"name": "resourcefact",
"schema": "${UTILITY_SCHEMA}",
"alias": "r",
"type": "LEFT",
"on": "e.resource_id = r.id"
},
{
"name": "person",
"schema": "${UTILITY_SCHEMA}",
"alias": "p",
"type": "LEFT",
"on": "ev.person_id = p.id"
},
{
"name": "person",
"schema": "${UTILITY_SCHEMA}",
"alias": "pi",
"type": "LEFT",
"on": "a.principalinvestigator_person_id = pi.id"
}
],
"orderby": [
Expand Down
12 changes: 12 additions & 0 deletions configuration/etl/etl_tables.d/cloud_common/cloudfact_by_.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
"type": "int(11)",
"nullable": false,
"comment": "DIMENSION: The person id associated with a VM instance."
},{
"name": "person_organization_id",
"type": "int(11)",
"nullable": false,
"default": -1,
"comment": "DIMENSION: The organization of the person to whom the VM is assigned."
},{
"name": "systemaccount_id",
"type": "int(11)",
Expand Down Expand Up @@ -127,6 +133,12 @@
"nullable": false,
"default": -1,
"comment": "DIMENSION: The PI that owns the allocations that these VM's ran under. References principalinvestigator.person_id"
},{
"name": "piperson_organization_id",
"type": "int(11)",
"nullable": false,
"default": -1,
"comment": "DIMENSION: The organization of the PI that owns the project that funds these VM's. References piperson.organization_id"
},{
"name": "fos_id",
"type": "int(11)",
Expand Down
12 changes: 12 additions & 0 deletions configuration/etl/etl_tables.d/cloud_common/cloudfact_by_day.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"type": "int(11)",
"nullable": false,
"comment": "DIMENSION: The person id associated with a VM instance."
},{
"name": "person_organization_id",
"type": "int(11)",
"nullable": false,
"default": -1,
"comment": "DIMENSION: The organization of the person that ran the jobs."
},{
"name": "systemaccount_id",
"type": "int(11)",
Expand Down Expand Up @@ -132,6 +138,12 @@
"nullable": false,
"default": -1,
"comment": "DIMENSION: The PI that owns the allocations that these VM's ran under. References principalinvestigator.person_id"
},{
"name": "piperson_organization_id",
"type": "int(11)",
"nullable": false,
"default": -1,
"comment": "DIMENSION: The organization of the PI that owns the project that funds these VMs. References piperson.organization_id"
},{
"name": "fos_id",
"type": "int(11)",
Expand Down
12 changes: 12 additions & 0 deletions configuration/etl/etl_tables.d/cloud_common/session_records.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
"type": "int(11)",
"nullable": true
},
{
"name": "person_organization_id",
"type": "int(11)",
"nullable": false,
"default": -1
},
{
"name": "systemaccount_id",
"type": "int(11)",
Expand Down Expand Up @@ -146,6 +152,12 @@
"default": -1,
"comment": "DIMENSION: The PI that owns the allocations that these VM's ran under. References principalinvestigator.person_id"
},
{
"name": "piperson_organization_id",
"type": "int(11)",
"nullable": false,
"default": -1
},
{
"name": "fos_id",
"type": "int(11)",
Expand Down