Skip to content

Commit

Permalink
WIP #264 working on runExperiment config update.
Browse files Browse the repository at this point in the history
  • Loading branch information
finger563 committed Jul 22, 2018
1 parent e96887e commit 02dff7f
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 110 deletions.
2 changes: 1 addition & 1 deletion src/plugins/InstallRuntime/configWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ define([
"displayName": "User for " + hostName,
"description": "Select User for Host deployment or Disabled to exclude host.",
"value": users[0] || disabledMessage,
valueItems: users.concat(disabledMessage),
"valueItems": users.concat(disabledMessage),
"valueType": "string"
};

Expand Down
96 changes: 55 additions & 41 deletions src/plugins/RunExperiment/configWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ define([
// for each container create sortable selection of nodes for ordering their starting
var containerNodeMap = _containerNodeMap;
var containerConfig = self.makeContainerConfig( containerNodeMap );
pluginMetadata.configStructure = containerConfig.concat(pluginMetadata.configStructure);

// how do we want to do debugging?
var debugConfig = self.makeDebugConfig( containerNodeMap );
pluginMetadata.configStructure = debugConfig.concat(pluginMetadata.configStructure);
pluginMetadata.configStructure = [containerConfig].concat(pluginMetadata.configStructure);

// figure out their users
var hostUserMap = self.makeHostUserMap( hosts, users );
Expand All @@ -84,7 +80,11 @@ define([

// where do we want to spawn roscore?
var rosCoreConfig = self.makeRosCoreConfig( hosts );
pluginMetadata.configStructure = rosCoreConfig.concat(pluginMetadata.configStructure);
pluginMetadata.configStructure = [rosCoreConfig].concat(pluginMetadata.configStructure);

// how do we want to do debugging?
var debugConfig = self.makeDebugConfig( containerNodeMap );
pluginMetadata.configStructure = pluginMetadata.configStructure.concat(debugConfig);

var pluginDialog = new PluginConfigDialog({client: self._client});
pluginDialog.show(globalConfigStructure, pluginMetadata, prevPluginConfig, callback);
Expand Down Expand Up @@ -197,29 +197,25 @@ define([
};

ConfigWidget.prototype.makeContainerConfig = function( containerNodeMap ) {
var self = this,
config = [];

var tmpl = {
"name": "",
"displayName": "",
"description": "Sort the nodes in the order you wish to start them, top to bottom.",
"value": "",
"valueType": "sortable",
"valueItems": [
]
};

Object.keys(containerNodeMap).map(function(containerPath) {
var containerTmpl = Object.assign({}, tmpl);
containerTmpl.name = 'Container:'+containerPath;
containerTmpl.displayName = containerNodeMap[ containerPath ].name;
containerTmpl.valueItems = containerNodeMap[ containerPath ].nodes;
var self = this;

config.push(containerTmpl);
return Object.keys(containerNodeMap).reduce(function(o, containerPath) {
var tmpl = {
"name": containerPath,
"displayName": containerNodeMap[ containerPath ].name,
"description": "Sort the nodes in the order you wish to start them, top to bottom.",
"value": "",
"valueType": "sortable",
"valueItems": containerNodeMap[ containerPath ].nodes
};
o.configStructure.push(tmpl);
return o;
}, {
"name": "containerConfig",
"displayName": "Container Configuration",
"valueType": "header",
"configStructure": []
});

return config;
};

ConfigWidget.prototype.makeHostConfig = function( hostUserMap ) {
Expand Down Expand Up @@ -255,8 +251,7 @@ define([
};

ConfigWidget.prototype.makeRosCoreConfig = function( hosts ) {
var self = this,
config = [];
var self = this;

var hostNames = [ 'Any' ];
hostNames = hostNames.concat(
Expand All @@ -266,19 +261,38 @@ define([
);

hostNames.push('None');

var tmpl = {
"name": "rosCoreHost",
"displayName": "ROS Core Host",
"description": "Select Host / Any / None to select where and whether to spawn ROS Core / ROS Master.",
"value": hostNames[0],
"valueType": "string",
"valueItems": hostNames
};

config.push(tmpl);

return config;
return {
"name": "rosCoreConfig",
"displayName": "ROS Core Config",
"valueType": "header",
"configStructure": [
{
"name": "rosCoreHost",
"displayName": "ROS Core Host",
"description": "Select Host / Any / None to select where and whether to spawn ROS Core / ROS Master.",
"value": hostNames[0],
"valueType": "string",
"valueItems": hostNames
},
{
"name": "rosMasterURI",
"displayName": "ROS Master URI.",
"description": "Connect to provided ROS MASTER URI if ROS Core Host is set to 'None'. Has the form of 'http://<IP Address>:<Port Number>'",
"value": "",
"valueType": "string",
"readOnly": false
},
{
"name": "rosNamespace",
"displayName": "ROS Namespace.",
"description": "Sets the ROS_NAMESPACE for the experiment.",
"value": "",
"valueType": "string",
"readOnly": false
},
]
};
};

return ConfigWidget;
Expand Down
127 changes: 59 additions & 68 deletions src/plugins/RunExperiment/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,71 @@
"version": "1.0.0",
"description": "Maps the containers to available hosts and runs the experiment.",
"icon": {
"class": "glyphicon glyphicon-ok-circle",
"src": ""
"class": "glyphicon glyphicon-ok-circle",
"src": ""
},
"disableServerSideExecution": false,
"disableBrowserSideExecution": false,
"configWidget": "plugin/RunExperiment/RunExperiment/configWidget",
"configStructure": [
{
"name": "rosMasterURI",
"displayName": "ROS Master URI.",
"description": "Connect to provided ROS MASTER URI if ROS Core Host is set to 'None'. Has the form of 'http://<IP Address>:<Port Number>'",
"value": "",
"valueType": "string",
"readOnly": false
},
{
"name": "rosNamespace",
"displayName": "ROS Namespace.",
"description": "Sets the ROS_NAMESPACE for the experiment.",
"value": "",
"valueType": "string",
"readOnly": false
},
{
"name": "waitTime",
"displayName": "Wait Time (s)",
"description": "How long to wait (in seconds) between spawning of processes.",
"value": 0,
{
"name": "rosbridge",
"displayName": "ROS Bridge Config",
"valueType": "header",
"configStructure": [
{
"name": "spawn",
"displayName": "Spawn ROSBridge server.",
"description": "If true, it will spawn a ROS Bridge server on the ROSMOD server that connects to the system",
"value": false,
"valueType": "boolean",
"readOnly": false
},
{
"name": "port",
"displayName": " ROSBridge server port.",
"description": "What port number should we give ROSBridge server? Leave blank for a randomly assigned port",
"value": 0,
"minValue": 0,
"maxValue": 65535,
"valueType": "integer",
"readOnly": false
},
{
"name": "IP",
"displayName": " ROSBridge server IP.",
"description": "What is the ROS_IP of the rosbridge server - this is the IP that the nodes in the system will use to connect to the rosbridge server.",
"value": "127.0.0.1",
"valueType": "string",
"readOnly": false
}
]
},
{
"name": "waitTime",
"displayName": "Wait Time (s)",
"description": "How long to wait (in seconds) between spawning of processes.",
"value": 0,
"minValue": 0,
"maxValue": 200,
"valueType": "integer",
"readOnly": false
},
{
"name": "forceIsolation",
"displayName": "Force Isolation.",
"description": "If true, enforces that the spawned processes must run on hosts which are not currently running other ROSMOD processes.",
"value": true,
"valueType": "boolean",
"readOnly": false
},
{
"name": "spawnROSBridge",
"displayName": "Spawn ROSBridge server.",
"description": "If true, it will spawn a ROS Bridge server on the ROSMOD server that connects to the system",
"value": false,
"valueType": "boolean",
"readOnly": false
},
{
"name": "rosBridgePort",
"displayName": " ROSBridge server port.",
"description": "What port number should we give ROSBridge server? Leave blank for a randomly assigned port",
"value": 0,
"minValue": 0,
"maxValue": 65535,
"valueType": "integer",
"readOnly": false
},
{
"name": "rosBridgeServerIp",
"displayName": " ROSBridge server IP.",
"description": "What is the ROS_IP of the rosbridge server - this is the IP that the nodes in the system will use to connect to the rosbridge server.",
"value": "127.0.0.1",
"valueType": "string",
"readOnly": false
},
{
"name": "returnZip",
"displayName": "Zip and return generated artifacts.",
"description": "If true, it enables the client to download a zip of the artifacts.",
"value": false,
"valueType": "boolean",
"readOnly": false
}
"valueType": "integer",
"readOnly": false
},
{
"name": "forceIsolation",
"displayName": "Force Isolation.",
"description": "If true, enforces that the spawned processes must run on hosts which are not currently running other ROSMOD processes.",
"value": true,
"valueType": "boolean",
"readOnly": false
},
{
"name": "returnZip",
"displayName": "Zip and return generated artifacts.",
"description": "If true, it enables the client to download a zip of the artifacts.",
"value": false,
"valueType": "boolean",
"readOnly": false
}
]
}

0 comments on commit 02dff7f

Please sign in to comment.