Skip to content

Commit

Permalink
changes to utilization computation. removing unneeded columns
Browse files Browse the repository at this point in the history
  • Loading branch information
eiffel777 committed Mar 5, 2020
1 parent 8cc889e commit cec0211
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ class CoreUtilizationStatistic extends \DataWarehouse\Query\Cloud\Statistic
{
public function __construct($query_instance = null)
{
$agg_unit = $query_instance->getAggregationUnit()->getUnitName();
$agg_id = $agg_unit."_id";

$sql = 'COALESCE((SUM(jf.core_time) / SUM(DISTINCT jf.core_time_available)) * 100, 0)';
$sql = 'COALESCE(SUM(jf.core_time) / (SELECT
SUM(rf.core_time_available)
FROM
modw_aggregates.resourcespecsfact_by_'.$agg_unit.' rf
WHERE
rf.'.$agg_id.' = jf.'.$agg_id.'
AND FIND_IN_SET(rf.resource_id,
GROUP_CONCAT(DISTINCT jf.host_resource_id)) <> 0) * 100, 0)';

if ($query_instance->getQueryType() == 'aggregate') {
$agg_unit = $query_instance->getAggregationUnit()->getUnitName();
$agg_id = $agg_unit."_id";

$core_hours_sql = '
SELECT SUM(rsa.core_time_available) FROM modw_aggregates.resourcespecsfact_by_'.$agg_unit.' as rsa WHERE rsa.'.$agg_id.' BETWEEN '.$query_instance->getMinDateId().' AND '. $query_instance->getMaxDateId().')';
SELECT SUM(rsa.core_time_available) FROM modw_aggregates.resourcespecsfact_by_'.$agg_unit.' as rsa WHERE rsa.'.$agg_id.' BETWEEN '.$query_instance->getMinDateId().' AND '. $query_instance->getMaxDateId().
' AND FIND_IN_SET(rsa.resource_id, GROUP_CONCAT(DISTINCT jf.host_resource_id)) <> 0)';

$sql = "COALESCE((SUM(jf.core_time) / ($core_hours_sql) * 100, 0)";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"wallduration": "COALESCE(SUM(${wallduration_case_statement}), 0)",
"submission_venue_id": "sr.submission_venue_id",
"domain_id": "sr.domain_id",
"service_provider": "sr.service_provider",
"core_time_available": "COALESCE(rsa.core_time_available, 0)"
"service_provider": "sr.service_provider"
},
"groupby": [
"${AGGREGATION_UNIT}_id",
Expand Down Expand Up @@ -75,12 +74,6 @@
"schema": "${UTILITY_SCHEMA}",
"alias": "task_resource",
"on": "task_resource.id = sr.resource_id"
},{
"name": "resourcespecsfact_by_${AGGREGATION_UNIT}",
"schema": "modw_aggregates",
"alias": "rsa",
"type": "LEFT",
"on": "rsa.resource_id = sr.resource_id AND rsa.${AGGREGATION_UNIT}_id = ${:PERIOD_ID}"
}
],
"where": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@
"type": "int(11)",
"nullable": true,
"comment": "DIMENSION: A service provider is an institution that hosts resources."
},{
"name": "core_time_available",
"type": "bigint(42)",
"nullable": true,
"comment": "DIMENSION: Amount of core time in seconds available in this time period."
}
],

Expand Down
4 changes: 2 additions & 2 deletions tests/ci/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ then
then
sudo -u xdmod xdmod-shredder -r openstack -d $REF_DIR/openstack -f openstack
sudo -u xdmod xdmod-shredder -r nutsetters -d $REF_DIR/nutsetters -f openstack
sudo -u xdmod php /usr/share/xdmod/tools/etl/etl_overseer.php -p ingest-cloud-resource-specs -d "CLOUD_RESOURCE_SPECS_DIRECTORY=$REF_DIR/openstack_resource_specs" -r openstack -v debug
sudo -u xdmod php /usr/share/xdmod/tools/etl/etl_overseer.php -p ingest-cloud-resource-specs -d "CLOUD_RESOURCE_SPECS_DIRECTORY=$REF_DIR/openstack_resource_specs" -r openstack
fi
sudo -u xdmod xdmod-ingestor

Expand Down Expand Up @@ -124,7 +124,7 @@ then

sudo -u xdmod xdmod-shredder -r openstack -d $REF_DIR/openstack -f openstack
sudo -u xdmod xdmod-shredder -r nutsetters -d $REF_DIR/nutsetters -f openstack
sudo -u xdmod php /usr/share/xdmod/tools/etl/etl_overseer.php -p ingest-cloud-resource-specs -d "CLOUD_RESOURCE_SPECS_DIRECTORY=$REF_DIR/openstack_resource_specs" -r openstack -v debug
sudo -u xdmod php /usr/share/xdmod/tools/etl/etl_overseer.php -p ingest-cloud-resource-specs -d "CLOUD_RESOURCE_SPECS_DIRECTORY=$REF_DIR/openstack_resource_specs" -r openstack
sudo -u xdmod xdmod-ingestor
fi
fi

0 comments on commit cec0211

Please sign in to comment.