From dea48858b073631ffa86db9314c670d5f2e0f43f Mon Sep 17 00:00:00 2001 From: Ben Plessinger Date: Fri, 22 Mar 2019 13:48:06 -0400 Subject: [PATCH] add patches needed for federation --- build.json | 7 +- classes/OpenXdmod/Setup/FederatedSetup.php | 41 +- classes/OpenXdmod/Setup/SetFederatedRole.php | 80 +++ .../federated/cloud/instance.json | 5 +- configuration/portal_settings.d/federated.ini | 4 + docs/federated-installation.md | 1 + patches/federated/README.md | 10 + patches/federated/configuration.diff | 148 +++++ patches/federated/nojobs-configuration.diff | 515 ++++++++++++++++++ patches/federated/nojobs-usr-share-xdmod.diff | 28 + patches/federated/usr-share-xdmod.diff | 98 ++++ templates/portal_settings.template | 6 +- xdmod-federated.spec.in | 9 +- 13 files changed, 931 insertions(+), 21 deletions(-) create mode 100644 classes/OpenXdmod/Setup/SetFederatedRole.php create mode 100644 configuration/portal_settings.d/federated.ini create mode 100644 patches/federated/README.md create mode 100644 patches/federated/configuration.diff create mode 100644 patches/federated/nojobs-configuration.diff create mode 100644 patches/federated/nojobs-usr-share-xdmod.diff create mode 100644 patches/federated/usr-share-xdmod.diff diff --git a/build.json b/build.json index d5b600b..4d7ccb7 100644 --- a/build.json +++ b/build.json @@ -1,8 +1,7 @@ { "name": "xdmod-federated", - "version": "8.1.0", + "version": "8.1.2", "release": "0.1", - "prerelease": "beta1.20190122", "files": { "include_paths": [ ], @@ -21,7 +20,9 @@ }, "file_maps": { "data": [ - "classes" + "classes", + "patches", + { "templates": "templates/federated" } ], "bin": [ "bin/" diff --git a/classes/OpenXdmod/Setup/FederatedSetup.php b/classes/OpenXdmod/Setup/FederatedSetup.php index 2a1f456..a78eda1 100644 --- a/classes/OpenXdmod/Setup/FederatedSetup.php +++ b/classes/OpenXdmod/Setup/FederatedSetup.php @@ -41,26 +41,44 @@ class FederatedSetup extends SubMenuSetupItem public function __construct(Console $console) { parent::__construct($console); + $this->genMenu(); + } - $items = array( + public function genMenu(){ + $settings = $this->loadIniConfig('portal_settings', 'federated'); + $hubItems = array( new MenuItem( - '1', + '2', 'List current instances', - new ListFederatedInstancesSetup($console, $this) + new ListFederatedInstancesSetup($this->console, $this) ), new MenuItem( - '2', + '3', 'Add new instance', - new AddFederatedInstanceSetup($console, $this) - ), + new AddFederatedInstanceSetup($this->console, $this) + ) + ); + $items = array( new MenuItem( - 'r', - 'Return to main menu', - new SubMenuQuitSetup($console, $this) + '1', + 'Set Federation Role', + new SetFederatedRole($this->console, $this) ), ); - - $this->menu = new Menu($items, $console, 'Federated module setup'); + if($settings['federated_role'] === "hub"){ + $items = array_merge($items, $hubItems); + } + $items = array_merge( + $items, + array( + new MenuItem( + 'r', + 'Return to main menu', + new SubMenuQuitSetup($this->console, $this) + ), + ) + ); + $this->menu = new Menu($items, $this->console, 'Federated module setup'); } /** @@ -72,6 +90,7 @@ public function handle() $this->quit = false; while (!$this->quit) { + $this->genMenu(); $this->menu->display(); } } diff --git a/classes/OpenXdmod/Setup/SetFederatedRole.php b/classes/OpenXdmod/Setup/SetFederatedRole.php new file mode 100644 index 0000000..4d4c8fd --- /dev/null +++ b/classes/OpenXdmod/Setup/SetFederatedRole.php @@ -0,0 +1,80 @@ +parent = $parent; + } + + /** + * @inheritdoc + */ + public function handle() + { + $settings = $this->loadIniConfig('portal_settings', 'federated'); + $this->console->displaySectionHeader('Set Federation Role'); + $this->console->displayBlankLine(); + $role = strtolower( + $this->console->prompt( + 'Is this a federation `hub` or `instance`?', + $settings['federated_role'] + ) + ); + if($role !== $settings['federated_role']) + { + switch($role){ + case 'instance': + $url = $this->console->prompt('What is the url for the hub?', $settings['federated_huburl']); + if (empty($url)) { + $this->console->displayMessage("Error, instance URL is required!"); + } + else{ + if($settings['federated_role'] === 'hub'){ + $this->patchOpenXdmod(true); + } + $settings['federated_role'] = 'instance'; + $settings['federated_huburl'] = $url; + $this->saveIniConfig($settings, 'portal_settings', 'federated'); + } + break; + case 'hub': + $settings['federated_role'] = 'hub'; + $this->saveIniConfig($settings, 'portal_settings', 'federated'); + $this->patchOpenXdmod(); + break; + default: + $this->console->displayMessage("Error, no role specified!"); + $this->console->prompt('Press ENTER to continue.'); + } + } + } + function patchOpenXdmod($reverse = false){ + $directionOption = '--forward'; + $patchPath = DATA_DIR . '/patches/federated/'; + if($reverse){ + $directionOption = '--reverse'; + } + $this->executeCommand('patch --quiet ' . $directionOption . ' -up1 --directory=/usr/share/xdmod/ < ' . $patchPath . 'usr-share-xdmod.diff'); + $this->executeCommand('patch --quiet ' . $directionOption . ' -up2 --directory=/etc/xdmod/ < ' . $patchPath . 'configuration.diff'); + } +} diff --git a/configuration/etl/etl_action_defs.d/federated/cloud/instance.json b/configuration/etl/etl_action_defs.d/federated/cloud/instance.json index eb0049d..f36a53c 100644 --- a/configuration/etl/etl_action_defs.d/federated/cloud/instance.json +++ b/configuration/etl/etl_action_defs.d/federated/cloud/instance.json @@ -11,7 +11,7 @@ "instance_id": "scif.instance_id", "account_id": "scif.account_id", "provider_identifier": "COALESCE(scif.provider_identifier, 'unknown')", - "person_id": "upf.id" + "person_id": "COALESCE(upf.id, -1)" }, "joins": [ @@ -30,7 +30,8 @@ "schema": "${UTILITY_SCHEMA}", "name": "person", "alias": "upf", - "on": "upf.person_origin_id = scif.person_id AND upf.organization_id = drf.organization_id" + "on": "upf.person_origin_id = scif.person_id AND upf.organization_id = drf.organization_id", + "type": "LEFT" } ], "groupby": [ diff --git a/configuration/portal_settings.d/federated.ini b/configuration/portal_settings.d/federated.ini new file mode 100644 index 0000000..a43aab8 --- /dev/null +++ b/configuration/portal_settings.d/federated.ini @@ -0,0 +1,4 @@ +[federated] +version = "8.1.2" +role = +huburl = diff --git a/docs/federated-installation.md b/docs/federated-installation.md index 7fee057..32ff758 100644 --- a/docs/federated-installation.md +++ b/docs/federated-installation.md @@ -173,6 +173,7 @@ su - tungsten -c '/opt/continuent/software/tungsten-replicator-5.0.1/tools/tpm c ``` ```bash +su - tungsten -c '/opt/continuent/software/tungsten-replicator-5.0.1/tools/tpm update' su - tungsten -c '/opt/continuent/software/tungsten-replicator-5.0.1/tools/tpm update xdmodfederation' ``` diff --git a/patches/federated/README.md b/patches/federated/README.md new file mode 100644 index 0000000..d5d7411 --- /dev/null +++ b/patches/federated/README.md @@ -0,0 +1,10 @@ +When running a federation HUB you will need the following changes made to the OpenXDMoD code. +**NOTE** This is done automatically as part of `xdmod-setup` when setting the federation type to `hub` + +patch -up1 --directory=/usr/share/xdmod/ < patches/cloud/usr-share-xdmod.diff +patch -up2 --directory=/etc/xdmod/ < patches/cloud/configuration.diff + +If you have no jobs data use the following as well to remove Jobs related information. + +patch -up1 --directory=/usr/share/xdmod/ < patches/cloud/nojobs-usr-share-xdmod.diff +patch -up2 --directory=/etc/xdmod/ < patches/cloud/nojobs-configuration.diff diff --git a/patches/federated/configuration.diff b/patches/federated/configuration.diff new file mode 100644 index 0000000..98bf809 --- /dev/null +++ b/patches/federated/configuration.diff @@ -0,0 +1,148 @@ +diff --git a/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json b/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json +index f2fc4bd5..de5b4f7f 100644 +--- a/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json ++++ b/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json +@@ -27,7 +27,8 @@ + "year": "${:YEAR_VALUE}", + "${AGGREGATION_UNIT}": "${:PERIOD_VALUE}", + "host_resource_id": "sr.resource_id", +- "account_id": "instance.account_id", ++ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", ++ "account_id": "ca.primaryid", + "person_id": "sr.person_id", + "systemaccount_id": "sr.systemaccount_id", + "processorbucket_id": "(SELECT id FROM ${SOURCE_SCHEMA}.processor_buckets pb WHERE sr.num_cores BETWEEN pb.min_processors AND pb.max_processors)", +@@ -71,6 +72,13 @@ + "schema": "${UTILITY_SCHEMA}", + "alias": "task_resource", + "on": "task_resource.id = sr.resource_id" ++ }, ++ { ++ "#": "THE FOLLOWING IS ADDED BY THE FEDERATION MODULE", ++ "name":"account", ++ "alias":"ca", ++ "schema": "${SOURCE_SCHEMA}", ++ "on": "ca.resource_id = instance.resource_id AND ca.account_id = instance.account_id" + } + ], + "where": [ +diff --git a/configuration/etl/etl_action_defs.d/cloud_common/session_records.json b/configuration/etl/etl_action_defs.d/cloud_common/session_records.json +index 1ce31ca7..63f12522 100644 +--- a/configuration/etl/etl_action_defs.d/cloud_common/session_records.json ++++ b/configuration/etl/etl_action_defs.d/cloud_common/session_records.json +@@ -11,7 +11,8 @@ + "end_event_type_id": "e.end_event_id", + "resource_id": "it.resource_id", + "instance_type": "itt.instance_type", +- "instance_type_id": "itt.instance_type_id", ++ "#": "THE FOLLOWING WAS MODIFIFED BY THE FEDERATION MODULE", ++ "instance_type_id": "itt.primaryid", + "num_cores": "itt.num_cores", + "memory_mb": "itt.memory_mb", + "disk_gb": "itt.disk_gb", +diff --git a/configuration/etl/etl_tables.d/cloud_common/account.json b/configuration/etl/etl_tables.d/cloud_common/account.json +index b89f3f44..0d18fe83 100644 +--- a/configuration/etl/etl_tables.d/cloud_common/account.json ++++ b/configuration/etl/etl_tables.d/cloud_common/account.json +@@ -14,7 +14,7 @@ + "name": "account_id", + "type": "int(11)", + "nullable": false, +- "extra": "auto_increment", ++ "#": "Auto-increment REMOVED FROM THIS COLUMN BY THE FEDERATION", + "comment": "Unknown = 1" + }, + { +@@ -29,9 +29,17 @@ + "nullable": true, + "default": null, + "comment": "What to show the user" ++ }, ++ { ++ "#": "THIS HAS BEEN ADDED BY THE FEDERATION", ++ "name": "primaryid", ++ "type": "bigint(20) unsigned", ++ "nullable": false, ++ "extra": "auto_increment", ++ "comment": "Added by federation" + } + ], +- ++ "#": "THE FOLLOWING IS NOT VALID ON A FEDERATION HUB", + "#": "Note that the primary key is (resource, account) rather than account_id so we can", + "#": "take advantage of ON DUPLICATE KEY UPDATE to update existing entries and still use", + "#": "auto_increment for new entries.", +@@ -45,15 +53,16 @@ + + "indexes": [ + { ++ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", + "name": "PRIMARY", + "columns": [ +- "resource_id", +- "provider_account" ++ "primaryid" + ], + "is_unique": true + }, + { +- "name": "autoincrement_key", ++ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", ++ "name": "uniq", + "columns": [ + "resource_id", + "account_id" +diff --git a/configuration/etl/etl_tables.d/cloud_common/instance_type.json b/configuration/etl/etl_tables.d/cloud_common/instance_type.json +index f7d4e39e..0f769bbf 100644 +--- a/configuration/etl/etl_tables.d/cloud_common/instance_type.json ++++ b/configuration/etl/etl_tables.d/cloud_common/instance_type.json +@@ -16,7 +16,7 @@ + "name": "instance_type_id", + "type": "int(11)", + "nullable": false, +- "extra": "auto_increment", ++ "#": "Auto-increment REMOVED FROM THIS COLUMN BY THE FEDERATION", + "comment": "Auto-increment relative to resource_id. Unknown = 1" + }, + { +@@ -69,7 +69,15 @@ + "nullable": true, + "default": null, + "comment": "End time for this configuration as a unix timestamp to the microsecond., NULL if it is still in effect." +- } ++ }, ++ { ++ "#": "THIS HAS BEEN ADDED BY THE FEDERATION", ++ "name": "primaryid", ++ "type": "bigint(20) unsigned", ++ "nullable": false, ++ "extra": "auto_increment", ++ "comment": "Added by federation" ++ } + ], + + "#": "Note that the primary key is (resource, instance_type, num_cores, memory_mb, disk_gb)", +@@ -78,7 +86,14 @@ + + "indexes": [ + { +- "name": "PRIMARY", ++ "#": "THE FOLLOWING HAS BEEN ADDED BY THE FEDERATION MODULE", ++ "name": "PRIMARY", ++ "columns": [ ++ "primaryid" ++ ] ++ },{ ++ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", ++ "name": "uniq", + "columns": [ + "resource_id", + "instance_type", +@@ -89,6 +104,7 @@ + "is_unique": true + }, + { ++ "#": "THE FOLLOWING IS NOT VALID ON A FEDERATION HUB", + "#": "For MyISAM tables, you can specify AUTO_INCREMENT on a secondary column in a", + "#": "multiple-column index. In this case, the generated value for the AUTO_INCREMENT column", + "#": "is calculated as MAX(auto_increment_column) + 1 WHERE prefix=given-prefix. This is", diff --git a/patches/federated/nojobs-configuration.diff b/patches/federated/nojobs-configuration.diff new file mode 100644 index 0000000..306fb0f --- /dev/null +++ b/patches/federated/nojobs-configuration.diff @@ -0,0 +1,515 @@ +diff --git a/configuration/datawarehouse.json b/configuration/datawarehouse.json +index 6a3254a2..42a59465 100644 +--- a/configuration/datawarehouse.json ++++ b/configuration/datawarehouse.json +@@ -1,210 +1,5 @@ + { + "realms": { +- "Jobs": { +- "schema": "modw_aggregates", +- "table": "jobfact", +- "datasource": "HPcDB", +- "group_bys": [ +- { +- "name": "none", +- "class": "GroupByNone" +- }, +- { +- "name": "nodecount", +- "class": "GroupByNodeCount" +- }, +- { +- "name": "person", +- "class": "GroupByPerson" +- }, +- { +- "name": "pi", +- "class": "GroupByPI" +- }, +- { +- "name": "resource", +- "class": "GroupByResource" +- }, +- { +- "name": "resource_type", +- "class": "GroupByResourceType" +- }, +- { +- "name": "nsfdirectorate", +- "class": "GroupByNSFDirectorate" +- }, +- { +- "name": "parentscience", +- "class": "GroupByParentScience" +- }, +- { +- "name": "fieldofscience", +- "class": "GroupByScience" +- }, +- { +- "name": "jobsize", +- "class": "GroupByJobSize" +- }, +- { +- "name": "jobwalltime", +- "class": "GroupByJobTime" +- }, +- { +- "name": "jobwaittime", +- "class": "GroupByJobWaitTime" +- }, +- { +- "name": "queue", +- "class": "GroupByQueue" +- }, +- { +- "name": "username", +- "class": "GroupByUsername" +- }, +- { +- "name": "day", +- "class": "GroupByDay" +- }, +- { +- "name": "month", +- "class": "GroupByMonth" +- }, +- { +- "name": "quarter", +- "class": "GroupByQuarter" +- }, +- { +- "name": "year", +- "class": "GroupByYear" +- }, +- { +- "name": "provider", +- "class": "GroupByProvider", +- "visible": false +- } +- ], +- "statistics": [ +- { +- "name": "job_count", +- "class": "JobCountStatistic" +- }, +- { +- "name": "job_count", +- "class": "JobCountStatistic" +- }, +- { +- "name": "running_job_count", +- "class": "RunningJobCountStatistic", +- "control": true +- }, +- { +- "name": "started_job_count", +- "class": "StartedJobCountStatistic", +- "control": true +- }, +- { +- "name": "submitted_job_count", +- "class": "SubmittedJobCountStatistic" +- }, +- { +- "name": "active_person_count", +- "class": "ActiveUserCountStatistic" +- }, +- { +- "name": "active_pi_count", +- "class": "ActivePICountStatistic" +- }, +- { +- "name": "total_cpu_hours", +- "class": "TotalCPUHoursStatistic" +- }, +- { +- "name": "total_waitduration_hours", +- "class": "TotalWaitHoursStatistic" +- }, +- { +- "name": "total_node_hours", +- "class": "TotalNodeHoursStatistic" +- }, +- { +- "name": "total_wallduration_hours", +- "class": "TotalWallHoursStatistic" +- }, +- { +- "name": "avg_cpu_hours", +- "class": "AverageCPUHoursStatistic" +- }, +- { +- "name": "sem_avg_cpu_hours", +- "class": "SEMAverageCPUHoursStatistic", +- "visible": false +- }, +- { +- "name": "avg_node_hours", +- "class": "AverageNodeHoursStatistic" +- }, +- { +- "name": "sem_avg_node_hours", +- "class": "SEMAverageNodeHoursStatistic", +- "visible": false +- }, +- { +- "name": "avg_waitduration_hours", +- "class": "AverageWaitHoursStatistic" +- }, +- { +- "name": "sem_avg_waitduration_hours", +- "class": "SEMAverageWaitHoursStatistic", +- "visible": false +- }, +- { +- "name": "avg_wallduration_hours", +- "class": "AverageWallHoursStatistic" +- }, +- { +- "name": "sem_avg_wallduration_hours", +- "class": "SEMAverageWallHoursStatistic", +- "visible": false +- }, +- { +- "name": "avg_processors", +- "class": "AverageProcessorCountStatistic" +- }, +- { +- "name": "sem_avg_processors", +- "class": "SEMAverageProcessorCountStatistic", +- "visible": false +- }, +- { +- "name": "min_processors", +- "class": "MinProcessorCountStatistic" +- }, +- { +- "name": "max_processors", +- "class": "MaxProcessorCountStatistic" +- }, +- { +- "name": "utilization", +- "class": "UtilizationStatistic" +- }, +- { +- "name": "expansion_factor", +- "class": "ExpansionFactorStatistic" +- }, +- { +- "name": "normalized_avg_processors", +- "class": "NormalizedAverageProcessorCountStatistic" +- }, +- { +- "name": "avg_job_size_weighted_by_cpu_hours", +- "class": "JobSizeWeightedByCPUHours" +- }, +- { +- "name": "active_resource_count", +- "class": "ActiveResourceCountStatistic" +- } +- ] +- }, + "Storage": { + "schema": "modw", + "table": "storagefact", +@@ -361,14 +156,6 @@ + { + "name": "submission_venue", + "class": "GroupBySubmissionVenue" +- }, +- { +- "name": "person", +- "class": "GroupByPerson" +- }, +- { +- "name": "username", +- "class": "GroupByUsername" + } + ], + "statistics": [ +diff --git a/configuration/roles.json b/configuration/roles.json +index 0ae8c82b..bc053da8 100644 +--- a/configuration/roles.json ++++ b/configuration/roles.json +@@ -49,214 +49,8 @@ + "tooltip": "" + } + ], +- "query_descripters": [ +- { +- "realm": "Jobs", +- "group_by": "none" +- }, +- { +- "realm": "Jobs", +- "group_by": "jobsize" +- }, +- { +- "realm": "Jobs", +- "group_by": "jobwalltime" +- }, +- { +- "realm": "Jobs", +- "group_by": "jobwaittime" +- }, +- { +- "realm": "Jobs", +- "group_by": "nodecount" +- }, +- { +- "realm": "Jobs", +- "group_by": "nsfdirectorate" +- }, +- { +- "realm": "Jobs", +- "group_by": "parentscience" +- }, +- { +- "realm": "Jobs", +- "group_by": "fieldofscience" +- }, +- { +- "realm": "Jobs", +- "group_by": "pi" +- }, +- { +- "realm": "Jobs", +- "group_by": "queue" +- }, +- { +- "realm": "Jobs", +- "group_by": "resource" +- }, +- { +- "realm": "Jobs", +- "group_by": "resource_type" +- }, +- { +- "realm": "Jobs", +- "group_by": "person" +- }, +- { +- "realm": "Jobs", +- "group_by": "username" +- } +- ], +- "summary_charts": [ +- { +- "data_series": { +- "data": [ +- { +- "combine_type": "stack", +- "display_type": "column", +- "filters": { +- "data": [], +- "total": 0 +- }, +- "group_by": "resource", +- "has_std_err": false, +- "id": 0.00000000000001, +- "ignore_global": false, +- "log_scale": false, +- "long_legend": true, +- "metric": "total_cpu_hours", +- "realm": "Jobs", +- "sort_type": "value_desc", +- "std_err": false, +- "value_labels": false, +- "x_axis": false +- } +- ], +- "total": 1 +- }, +- "global_filters": { +- "data": [], +- "total": 0 +- }, +- "legend_type": "right_center", +- "limit": 10, +- "show_filters": true, +- "start": 0, +- "timeseries": true, +- "title": "Total CPU Hours By Resource (Top 10)" +- }, +- { +- "data_series": { +- "data": [ +- { +- "combine_type": "stack", +- "display_type": "column", +- "filters": { +- "data": [], +- "total": 0 +- }, +- "group_by": "jobsize", +- "has_std_err": false, +- "id": 0.00000000000002, +- "ignore_global": false, +- "log_scale": false, +- "long_legend": true, +- "metric": "total_cpu_hours", +- "realm": "Jobs", +- "sort_type": "value_desc", +- "std_err": false, +- "value_labels": false, +- "x_axis": false +- } +- ], +- "total": 1 +- }, +- "global_filters": { +- "data": [], +- "total": 0 +- }, +- "legend_type": "right_center", +- "limit": 20, +- "show_filters": true, +- "start": 0, +- "timeseries": true, +- "title": "Total CPU Hours by Job Size" +- }, +- { +- "data_series": { +- "data": [ +- { +- "combine_type": "side", +- "display_type": "column", +- "filters": { +- "data": [], +- "total": 0 +- }, +- "group_by": "none", +- "has_std_err": true, +- "id": 0.00000000000003, +- "ignore_global": false, +- "log_scale": false, +- "long_legend": true, +- "metric": "avg_processors", +- "realm": "Jobs", +- "sort_type": "none", +- "std_err": true, +- "value_labels": false, +- "x_axis": false +- } +- ], +- "total": 1 +- }, +- "global_filters": { +- "data": [], +- "total": 0 +- }, +- "legend_type": "off", +- "limit": 20, +- "show_filters": true, +- "start": 0, +- "timeseries": true, +- "title": "Avg Job Size (Core Count)" +- }, +- { +- "data_series": { +- "data": [ +- { +- "combine_type": "side", +- "display_type": "pie", +- "filters": { +- "data": [], +- "total": 0 +- }, +- "group_by": "pi", +- "has_std_err": true, +- "id": 0.00000000000004, +- "ignore_global": false, +- "log_scale": false, +- "long_legend": true, +- "metric": "total_cpu_hours", +- "realm": "Jobs", +- "sort_type": "value_desc", +- "std_err": true, +- "value_labels": true, +- "x_axis": false +- } +- ], +- "total": 1 +- }, +- "global_filters": { +- "data": [], +- "total": 0 +- }, +- "legend_type": "off", +- "limit": 10, +- "show_filters": true, +- "start": 0, +- "timeseries": false, +- "title": "Total CPU Hours by PI" +- } +- ] ++ "query_descripters": [], ++ "summary_charts": [] + }, + "pub": { + "display": "Public", +@@ -296,63 +90,6 @@ + } + ], + "query_descripters": [ +- { +- "realm": "Jobs", +- "group_by": "none" +- }, +- { +- "realm": "Jobs", +- "group_by": "fieldofscience" +- }, +- { +- "realm": "Jobs", +- "group_by": "jobsize" +- }, +- { +- "realm": "Jobs", +- "group_by": "jobwalltime" +- }, +- { +- "realm": "Jobs", +- "group_by": "jobwaittime" +- }, +- { +- "realm": "Jobs", +- "group_by": "nodecount" +- }, +- { +- "realm": "Jobs", +- "group_by": "nsfdirectorate" +- }, +- { +- "realm": "Jobs", +- "group_by": "parentscience" +- }, +- { +- "realm": "Jobs", +- "group_by": "pi" +- }, +- { +- "realm": "Jobs", +- "group_by": "queue" +- }, +- { +- "realm": "Jobs", +- "group_by": "resource" +- }, +- { +- "realm": "Jobs", +- "group_by": "resource_type" +- }, +- { +- "realm": "Jobs", +- "group_by": "person" +- }, +- { +- "realm": "Jobs", +- "group_by": "username", +- "disable": true +- } + ] + }, + "usr": { diff --git a/patches/federated/nojobs-usr-share-xdmod.diff b/patches/federated/nojobs-usr-share-xdmod.diff new file mode 100644 index 0000000..b315723 --- /dev/null +++ b/patches/federated/nojobs-usr-share-xdmod.diff @@ -0,0 +1,28 @@ +diff --git a/html/controllers/ui_data/summary3.php b/html/controllers/ui_data/summary3.php +index c2e93129..f791e6ac 100644 +--- a/html/controllers/ui_data/summary3.php ++++ b/html/controllers/ui_data/summary3.php +@@ -47,7 +47,9 @@ try { + } + } + } +- ++/* ++ * Removed when there is no JOBS REALM ++ * + $query_descripter = new \User\Elements\QueryDescripter('tg_summary', 'Jobs', 'none'); + + $query = new \DataWarehouse\Query\Jobs\Aggregate($aggregation_unit, $start_date, $end_date, 'none', 'all', $query_descripter->pullQueryParameters($raw_parameters)); +@@ -67,6 +69,7 @@ try { + throw $e; + } + } ++*/ + $mostPrivilegedAcl = Acls::getMostPrivilegedAcl($logged_in_user); + + $rolesConfig = \Configuration\XdmodConfiguration::assocArrayFactory('roles.json', CONFIG_DIR); +@@ -152,4 +155,3 @@ try { + 'data' => array(), + 'success' => false)); + } +- diff --git a/patches/federated/usr-share-xdmod.diff b/patches/federated/usr-share-xdmod.diff new file mode 100644 index 0000000..0ed6bf9 --- /dev/null +++ b/patches/federated/usr-share-xdmod.diff @@ -0,0 +1,98 @@ +diff --git a/classes/DataWarehouse/Access/Usage.php b/classes/DataWarehouse/Access/Usage.php +index f42adbca..60b6230a 100644 +--- a/classes/DataWarehouse/Access/Usage.php ++++ b/classes/DataWarehouse/Access/Usage.php +@@ -1248,7 +1248,10 @@ class Usage extends Common + $query = "SELECT id AS value FROM modw.resourcefact WHERE code = :value"; + break; + case 'project': +- $query = "SELECT account_id AS value FROM modw_cloud.account WHERE display = :value"; ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ ++ $query = "SELECT primaryid AS value FROM modw_cloud.account WHERE display LIKE :value"; + break; + } + +@@ -1262,7 +1265,10 @@ class Usage extends Common + $db = DB::factory('database'); + + $stmt = $db->prepare($query); +- $stmt->execute(array(':value' => $value)); ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ ++ $stmt->execute(array(':value' => $value . '%')); + + $rows = $stmt->fetchAll(PDO::FETCH_COLUMN, 0); + +diff --git a/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByConfiguration.php b/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByConfiguration.php +index 5715fcad..fb91c12a 100644 +--- a/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByConfiguration.php ++++ b/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByConfiguration.php +@@ -33,8 +33,11 @@ class GroupByConfiguration extends \DataWarehouse\Query\Cloud\GroupBy + parent::__construct( + 'configuration', + array(), ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ + "SELECT distinct +- gt.id, ++ gt.primaryid, + gt.instance_type as short_name, + gt.display as long_name, + gt.instance_type_id as order_id +@@ -42,7 +45,10 @@ class GroupByConfiguration extends \DataWarehouse\Query\Cloud\GroupBy + where 1 + order by order_id" + ); +- $this->_id_field_name = 'instance_type_id'; ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ ++ $this->_id_field_name = 'primaryid'; + $this->_long_name_field_name = 'display'; + $this->_short_name_field_name = 'instance_type'; + $this->_order_id_field_name = 'instance_type_id'; +@@ -121,7 +127,10 @@ class GroupByConfiguration extends \DataWarehouse\Query\Cloud\GroupBy + { + return parent::pullQueryParameterDescriptions2( + $request, +- "select long_name as field_label from modw_cloud.instance_type where id in (_filter_) order by instance_type_id" ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ ++ "SELECT long_name AS field_label FROM modw_cloud.instance_type WHERE primaryid IN (_filter_) ORDER BY instance_type_id" + ); + } + } +diff --git a/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByProject.php b/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByProject.php +index 1fba8e20..ccef7145 100644 +--- a/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByProject.php ++++ b/classes/DataWarehouse/Query/Cloud/GroupBys/GroupByProject.php +@@ -33,8 +33,11 @@ class GroupByProject extends \DataWarehouse\Query\Cloud\GroupBy + parent::__construct( + 'project', + array(), ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ + "SELECT distinct +- gt.account_id, ++ gt.primaryid, + gt.display as short_name, + gt.provider_account as long_name + FROM account gt +@@ -42,7 +45,10 @@ class GroupByProject extends \DataWarehouse\Query\Cloud\GroupBy + ORDER BY gt.account_id + " + ); +- $this->_id_field_name = 'account_id'; ++ /* ++ * THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE ++ */ ++ $this->_id_field_name = 'primaryid'; + $this->_long_name_field_name = 'display'; + $this->_short_name_field_name = 'provider_account'; + $this->_order_id_field_name = 'display'; diff --git a/templates/portal_settings.template b/templates/portal_settings.template index 8d86e22..28f965c 100644 --- a/templates/portal_settings.template +++ b/templates/portal_settings.template @@ -1,4 +1,6 @@ -[federated-general] +[federated] ; The version number is updated during the upgrade process. -version = "[:federated-general_version:]" +version = "[:federated_version:]" +role = "[:federated_role:]" +huburl = "[:federated_huburl:]" diff --git a/xdmod-federated.spec.in b/xdmod-federated.spec.in index 53d485e..81723dc 100644 --- a/xdmod-federated.spec.in +++ b/xdmod-federated.spec.in @@ -4,14 +4,15 @@ Release: __RELEASE__%{?dist} Summary: Federated module for Open XDMoD URL: http://federated.xdmod.org/ Vendor: Center for Computational Research, University at Buffalo -Packager: Benjamin D. Plessinger +Packager: XDMoD Group: Applications/Internet License: LGPLv3+ Source: %{name}-%{version}__PRERELEASE__.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}__PRERELEASE__-%{release}-XXXXXX) BuildArch: noarch BuildRequires: php-cli -Requires: xdmod >= 8.1.0, xdmod < 8.5.0, ruby +Requires: xdmod >= 8.1.0, xdmod < 8.2.0 +Requires: patch, ruby %description This package provides federated support for Open XDMoD. This module provides the @@ -55,5 +56,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/xdmod-fed-* %changelog -* Fri Mar 30 2018 Benjamin D. Plessinger 8.0.0-1.0 +* Thu May 16 2019 XDMoD 8.1.2-1.0 +- Release 8.1.2 +* Fri Mar 30 2018 XDMoD 8.0.0-0.5 - Initial Beta