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

Add PI information for the Cloud realm #1286

Merged
merged 22 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2462616
adding ability to ingest csv with that has cloud project to pi listin…
eiffel777 Apr 9, 2020
3cfdbc3
adding action defintions for ingesting cloud pi information to generi…
eiffel777 Apr 14, 2020
9f4f7db
added documentation for adding pi information to cloud realm
eiffel777 Apr 15, 2020
ec69845
adding regression tests
eiffel777 Apr 15, 2020
426cb28
update to aggregation
eiffel777 Apr 16, 2020
f36279b
adding correct documentation to staging_cloud_project_to_pi table def…
eiffel777 Apr 16, 2020
d71ce86
updating documentation
eiffel777 Apr 16, 2020
6382300
updating documentation
eiffel777 Apr 16, 2020
02ab833
updating integration tests
eiffel777 Apr 16, 2020
6b396ca
more updates to pass tests
eiffel777 Apr 16, 2020
581fe93
updates to documentation for cloud realm
eiffel777 Apr 17, 2020
6f8c59b
adding updates to test outputs
eiffel777 Apr 17, 2020
e4db182
make it so event log data does not need to be shredded in order for p…
eiffel777 Apr 20, 2020
c86d456
removing trailing whitespace to pass tests
eiffel777 Apr 20, 2020
18b5b77
Merge branch 'xdmod9.0' into cloud-add-pi-information
jpwhite4 May 4, 2020
9429850
updating username tests to reflect text changes as a result of adding…
eiffel777 May 4, 2020
2316344
Merge branch 'cloud-add-pi-information' of https://github.com/eiffel7…
eiffel777 May 4, 2020
8db3d48
Merge branch 'xdmod9.0' of https://github.com/ubccr/xdmod into cloud-…
eiffel777 May 4, 2020
824701f
Merge branch 'xdmod9.0' of https://github.com/ubccr/xdmod into cloud-…
eiffel777 May 5, 2020
fdcf2a1
Merge branch 'xdmod9.0' into cloud-add-pi-information
eiffel777 May 5, 2020
e3704e6
updating cloudfact_by_ table definition
eiffel777 May 7, 2020
5170d14
Merge branch 'xdmod9.0' into cloud-add-pi-information
eiffel777 May 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions bin/xdmod-import-csv
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ function main()
case 'group-to-hierarchy':
updateGroupToHierarchy($data);
break;
case 'cloud-project-to-pi':
updateCloudProjectToPI($data);
break;
plessbd marked this conversation as resolved.
Show resolved Hide resolved
default:
$logger->crit("Unknown type '$type'");
exit(1);
Expand Down Expand Up @@ -243,6 +246,22 @@ function main()
exit;
}

function updateCloudProjectToPI(array $piToProject){
global $db, $logger;
$logger->debug('Updating PI information for Cloud realm');
$sql = "
INSERT INTO
modw_cloud.staging_pi_to_project (pi_name, project_name, resource_name)
VALUES
(:pi, :project_name, :resource_name) ON DUPLICATE KEY UPDATE pi_name = VALUES(pi_name), resource_name = VALUES(resource_name)";
foreach($piToProject as $row){
$db->execute($sql, array(
":pi" => $row[0],
":project_name" => $row[1],
":resource_name" => $row[2]
));
}
}
/**
* Update people's names.
*
Expand Down Expand Up @@ -769,6 +788,10 @@ row.

Fields: groupname, hierachy item name

cloud-project-to-pi

Fields: pi_name, project_name, resource

NOTE: After updating any names or hierarchy items it is necessary to
reingest your data for the changes to be applied to the datawarehouse.
Hierarchy changes also require reaggregating data for the entire time
Expand Down
10 changes: 9 additions & 1 deletion classes/OpenXdmod/DataWarehouseInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,15 @@ public function ingestCloudDataOpenStack()
try {
$this->logger->notice('Ingesting OpenStack event log data');
Utilities::runEtlPipeline(
array('jobs-cloud-common', 'jobs-cloud-import-users-openstack', 'jobs-cloud-extract-openstack'),
array(
'staging-ingest-common',
'jobs-cloud-common',
'jobs-cloud-import-users-openstack',
'jobs-cloud-ingest-pi',
'hpcdb-ingest-common',
'hpcdb-xdw-ingest-common',
'jobs-cloud-extract-openstack'
),
$this->logger
);
}
Expand Down
3 changes: 3 additions & 0 deletions configuration/datawarehouse.d/ref/Cloud-group-bys.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,8 @@
},
"year": {
"$ref": "datawarehouse.d/ref/group-by-time-period.json#/year"
},
"pi": {
"$ref": "datawarehouse.d/ref/group-by-common.json#/pi"
}
}
77 changes: 76 additions & 1 deletion configuration/etl/etl.d/jobs_cloud_common.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
"options_class": "IngestorOptions",
"truncate_destination": false,
"enabled": true
},
"jobs-cloud-ingest-pi": {
"namespace": "ETL\\Ingestor",
"options_class": "IngestorOptions",
"class": "DatabaseIngestor",
"truncate_destination": false,
"enabled": true
}
},

Expand Down Expand Up @@ -53,7 +60,8 @@
"cloud_generic/raw_volume.json",
"cloud_common/domains.json",
"cloud_openstack/domain_submission_venue_staging.json",
"cloud_openstack/domain_submission_venue.json"
"cloud_openstack/domain_submission_venue.json",
"cloud_common/staging_cloud_project_to_pi.json"
]
},
{
Expand Down Expand Up @@ -180,5 +188,72 @@
}
}
}
],
"jobs-cloud-ingest-pi": [
{
"name": "pi-resource",
"description": "Ingest storage PI/Resource permutations",
"definition_file": "cloud_common/pi-resource.json",
"endpoints": {
"destination": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "mod_shredder"
}
}
},
{
"name": "pi",
"description": "Ingest storage PIs",
"definition_file": "cloud_common/pi.json",
"endpoints": {
"destination": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "mod_shredder"
}
}
},
{
"name": "union-user-pi--pi",
"description": "Ingest storage PIs (combined with users)",
"definition_file": "cloud_common/union-user-pi--pi.json",
"endpoints": {
"destination": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "mod_shredder"
}
}
},
{
"name": "union-user-pi-resource--pi",
"description": "Ingest storage PI/Resource permutations (combined with User/Resource permutations)",
"definition_file": "cloud_common/union-user-pi-resource--pi.json",
"endpoints": {
"destination": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "mod_shredder"
}
}
},
{
"name": "user-pi-resource",
"description": "Ingest storage User/PI/Resource permutations",
"definition_file": "cloud_common/user-pi-resource.json",
"endpoints": {
"destination": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "mod_shredder"
}
}
}
]
}
10 changes: 9 additions & 1 deletion configuration/etl/etl.d/jobs_cloud_generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,15 @@
"name": "GenericCloudAccountIngestor",
"description": "Generic cloud account data",
"class": "DatabaseIngestor",
"definition_file": "cloud_generic/account.json"
"definition_file": "cloud_generic/account.json",
"endpoints": {
"utility": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "modw"
}
}
},
{
"name": "GenericCloudHostIngestor",
Expand Down
10 changes: 9 additions & 1 deletion configuration/etl/etl.d/jobs_cloud_openstack.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,15 @@
"name": "OpenStackCloudAccountIngestor",
"description": "OpenStack cloud account data",
"class": "DatabaseIngestor",
"definition_file": "cloud_openstack/account.json"
"definition_file": "cloud_openstack/account.json",
"endpoints": {
"utility": {
"type" : "mysql",
"name" : "Cloud DB",
"config" : "datawarehouse",
"schema": "modw"
}
}
},
{
"name": "OpenStackCloudHostIngestor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"wallduration": "COALESCE(SUM(${wallduration_case_statement}), 0)",
"submission_venue_id": "sr.submission_venue_id",
"domain_id": "sr.domain_id",
"service_provider": "sr.service_provider"
"service_provider": "sr.service_provider",
"principalinvestigator_person_id": "a.principalinvestigator_person_id"
},
"groupby": [
"${AGGREGATION_UNIT}_id",
Expand Down Expand Up @@ -74,6 +75,11 @@
"schema": "${UTILITY_SCHEMA}",
"alias": "task_resource",
"on": "task_resource.id = sr.resource_id"
},{
"name": "account",
"schema": "${SOURCE_SCHEMA}",
"alias": "a",
"on": "instance.account_id = a.account_id"
}
],
"where": [
Expand Down
18 changes: 18 additions & 0 deletions configuration/etl/etl_action_defs.d/cloud_common/pi-resource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"table_definition": {
"$ref": "${table_definition_dir}/common/staging/pi-resource.json#/table_definition"
},
"source_query": {
"records": {
"pi_name": "DISTINCT pi.pi_name",
"resource_name": "pi.resource_name"
},
"joins": [
{
"schema": "${SOURCE_SCHEMA}",
"name": "staging_pi_to_project",
"alias": "pi"
}
]
}
}
17 changes: 17 additions & 0 deletions configuration/etl/etl_action_defs.d/cloud_common/pi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"table_definition": {
"$ref": "${table_definition_dir}/common/staging/pi.json#/table_definition"
},
"source_query": {
"records": {
"pi_name": "DISTINCT pi.pi_name"
jpwhite4 marked this conversation as resolved.
Show resolved Hide resolved
},
"joins": [
{
"schema": "${SOURCE_SCHEMA}",
"name": "staging_pi_to_project",
"alias": "pi"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"table_definition": {
"$ref": "${table_definition_dir}/common/staging/union-user-pi.json#/table_definition"
},
"source_query": {
"records": {
"union_user_pi_name": "DISTINCT pi.pi_name"
},
"joins": [
{
"schema": "${SOURCE_SCHEMA}",
"name": "staging_pi_to_project",
"alias": "pi"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"table_definition": {
"$ref": "${table_definition_dir}/common/staging/union-user-pi.json#/table_definition"
},
"source_query": {
"records": {
"union_user_pi_name": "DISTINCT pi.user_name"
},
"joins": [
{
"schema": "${SOURCE_SCHEMA}",
"name": "staging_pi_to_project",
"alias": "pi"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"table_definition": {
"$ref": "${table_definition_dir}/common/staging/union-user-pi-resource.json#/table_definition"
},
"source_query": {
"records": {
"union_user_pi_name": "DISTINCT pi.pi_name",
"resource_name": "pi.resource_name"
},
"joins": [
{
"schema": "${SOURCE_SCHEMA}",
"name": "staging_pi_to_project",
"alias": "pi"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"table_definition": {
"$ref": "${table_definition_dir}/common/staging/user-pi-resource.json#/table_definition"
},
"source_query": {
"records": {
"user_name": "DISTINCT pi.pi_name",
"pi_name": "pi.pi_name",
"resource_name": "pi.resource_name"
},
"joins": [
{
"schema": "${SOURCE_SCHEMA}",
"name": "staging_pi_to_project",
"alias": "pi"
}
]
}
}
31 changes: 30 additions & 1 deletion configuration/etl/etl_action_defs.d/cloud_generic/account.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,43 @@
"records": {
"resource_id": "raw.resource_id",
"provider_account": "raw.provider_account",
"display": "raw.provider_account"
"display": "raw.provider_account",
"principalinvestigator_person_id": "COALESCE(p.person_id, -1)"
},

"joins": [
{
"name": "generic_cloud_raw_event",
"schema": "${SOURCE_SCHEMA}",
"alias": "raw"
},
{
"name": "resourcefact",
"schema": "${UTILITY_SCHEMA}",
"alias": "rf",
"type": "LEFT",
"on": "raw.resource_id = rf.id"
},
{
"name": "staging_pi_to_project",
"schema": "${SOURCE_SCHEMA}",
"alias": "pi",
"type": "LEFT",
"on": "raw.provider_account = pi.project_name AND rf.code = pi.resource_name"
},
{
"name": "account",
"schema": "${UTILITY_SCHEMA}",
"alias": "a",
"type": "LEFT",
"on": "pi.pi_name = a.charge_number"
},
{
"name": "principalinvestigator",
"schema": "${UTILITY_SCHEMA}",
"alias": "p",
"type": "LEFT",
"on": "a.id = p.request_id"
}
],

Expand Down
Loading