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

Remove collection configuration option. #59

Merged
merged 2 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"error",
"all"
],
"no-underscore-dangle": [
"error",
{
"allow": [
"_extend"
]
}
],
"brace-style": [
"error",
"1tbs",
Expand Down
4 changes: 4 additions & 0 deletions classes/DataWarehouse/Query/SUPREMM/SupremmDbInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public function __construct() {
}
$sresource['database'] = \xd_utilities\getConfigurationSection($dbsection);

if (!isset($sresource['collection']) ) {
$sresource['collection'] = 'resource_' . $sresource['resource_id'];
}

$this->resource_rmap[$sresource['resource_id']] = $sresource;
}

Expand Down
1 change: 0 additions & 1 deletion classes/OpenXdmod/Setup/SupremmEditResourceSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function handle()
if($this->resourceConf['enabled']) {

$this->resourceConf['datasetmap'] = $this->console->prompt('Dataset mapping', $this->resourceConf['datasetmap']);
$this->resourceConf['collection'] = $this->console->prompt('MongoDB collection name', $this->resourceConf['collection']);

$this->resourceConf['hardware']['gpfs'] = $this->console->prompt('GPFS mount point (leave empty if no GPFS)', $this->resourceConf['hardware']['gpfs']);
}
Expand Down
1 change: 0 additions & 1 deletion classes/OpenXdmod/Setup/SupremmResourcesSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ private function defaultSettings($id)
'resource' => '',
'enabled' => false,
'datasetmap' => 'pcp',
'collection' => "resource_$id",
'hardware' => array(
'gpfs' => ''
)
Expand Down
1 change: 0 additions & 1 deletion configuration/supremm_resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{
"resource": "pcp",
"resource_id": 1,
"collection": "resource_1",
"datasetmap": "pcp",
"hardware": {
"gpfs": "gpfs0"
Expand Down
23 changes: 17 additions & 6 deletions docs/supremm-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ By default all the resources are disabled. You must select the "Edit
resource" option for each resource that you wish to configure to appear in the
SUPReMM realm and follow the prompt to enable the resource and set the correct
options. The "Dataset mapping" should be set to pcp if processing job summaries
generated from PCP data. The MongoDB collection name should be set to the name
of the mongoDB collection that contains the job summaries for the resource.
generated from PCP data.

SUPReMM configuration files
---------------------------
Expand All @@ -75,7 +74,6 @@ the `resources.json` and `resource_specs.json` main configuration files
"resource_id": 1,
"enabled": true,
"datasetmap": "pcp",
"collection": "resource_1",
"hardware": {
"gpfs": ""
}
Expand All @@ -99,9 +97,6 @@ where `%resource%` should be replaced with the `resource` parameter from the
The `datasetmap` option allows the ingestion of SUPReMM data from different
data sources. Currently PCP is the only supported data source.

The collection name should be set to the name of the mongoDB collection that
contains the job summaries for the resource.

The `hardware` property is used by the dataset mapping code to process PCP
metrics that have device-specific names. The only configurable mapping
in this release is the name of the GPFS mount point. If the resource has
Expand All @@ -124,6 +119,22 @@ the database name in the connection URI.** If the database is not specifed then
the mongo driver defaults to the 'test' database, which will not contain the
job summary data.

Advanced Configuration Options
---------------------------

The resource configuration file `supremm_resources.json` has optional advanced
configuration settings for each resource.

The `$.resources[*].collection` option overrides the collection name in the
MongoDB. This option can be used to set a non default collection name.

The `$.resources[*].db` option specifies the name of the section in the
portal_settings file that contains the database configuration settings. This
setting can be used to support an XDMoD instance ingesting data from multiple
MongoDB databases.



[mongo documentation]: https://docs.mongodb.org/manual/reference/connection-string/
[shredder]: shredder.md
[ingestor]: ingestor.md
Expand Down
33 changes: 18 additions & 15 deletions etl/js/config/supremm/etl.profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,31 @@ var markAsProcessedMongoUpdate = function(collection, _id, config, endFn, dbkey)
});
};

var getMongoSettings = function(config, datasetConfig) {

var section = "jobsummarydb";
if(datasetConfig.db) {
var getMongoSettings = function (config, datasetConfig) {
var section = 'jobsummarydb';
if (datasetConfig.db) {
section = datasetConfig.db;
}

var dbsettings = config.xdmodConfig[section];

if(!dbsettings) {
throw new Error("MongoDB configuration section \"" + section + "\" missing from XDMoD portal_settings.");
if (!config.xdmodConfig[section]) {
throw new Error('MongoDB configuration section "' + section + '" missing from XDMoD portal_settings.');
}

var dbsettings = util._extend({}, config.xdmodConfig[section]);

// Backwards compatibility with host/port specification
if(!dbsettings.uri && dbsettings.host && dbsettings.port && dbsettings.db) {
dbsettings.uri = "mongodb://" + dbsettings.host + ":" + dbsettings.port + "/" + dbsettings.db;
if (!dbsettings.uri && dbsettings.host && dbsettings.port && dbsettings.db) {
dbsettings.uri = 'mongodb://' + dbsettings.host + ':' + dbsettings.port + '/' + dbsettings.db;
}

if (!(dbsettings.uri && dbsettings.db_engine)) {
throw new Error('Missing MongoDB configuration settings in section "' + section + '" of the XDMoD portal_settings.');
}

if(!(dbsettings.uri && dbsettings.db_engine)) {
throw new Error("Missing MongoDB configuration settings in section \"" + section + "\" of the XDMoD portal_settings.");
if (datasetConfig.collection) {
dbsettings.collection = datasetConfig.collection;
} else {
dbsettings.collection = 'resource_' + datasetConfig.resource_id;
}

return dbsettings;
Expand Down Expand Up @@ -114,9 +119,7 @@ module.exports = {
mapping: this.getDatasetMap(datasetConfig[i].datasetmap, datasetConfig[i]),
input: {
dbEngine: db.db_engine.toLowerCase(),
config: util._extend({
collection: datasetConfig[i].collection
}, db),
config: db,
sortQuery: {},
getQuery: function() {
return getJobsToProcessMongoQuery(this.databasekey);
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/scripts/xdmod-setup.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ for {set i 1} {$i < 6} {incr i} {
selectMenuOption $i
answerQuestion {Enabled \(yes, no\)} {yes}
answerQuestion {Dataset mapping} {pcp}
answerQuestion {MongoDB collection name} "resource_$i"
provideInput {GPFS mount point (leave empty if no GPFS)} {gpfs0}
}
selectMenuOption s
Expand Down