Commit 73de0562 authored by Greg Watson's avatar Greg Watson
Browse files

Merge branch 'next' of https://github.com/eclipse/ice into next

parents 79df032f d322eefa
package org.eclipse.ice.item.action;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionHostService;
import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteServicesManager;
import org.eclipse.remote.core.exception.RemoteConnectionException;
......@@ -82,26 +79,17 @@ public abstract class RemoteAction extends Action {
}
if (connectionType != null) {
try {
// Loop over existing connections to see if the user already
// specified
// a connection to the provided host
for (IRemoteConnection c : connectionType
.getConnections()) {
String connectionHost = c
.getService(IRemoteConnectionHostService.class)
.getHostname();
if (InetAddress.getByName(host).getHostAddress()
.equals(InetAddress.getByName(connectionHost)
.getHostAddress())) {
connection = c;
// Found it, return the connection
return connection;
}
// Loop over existing connections to see if the user already
// specified
// a connection to the provided host
for (IRemoteConnection c : connectionType.getConnections()) {
if (host.equals(c.getName())) {
connection = c;
// Found it, return the connection
return connection;
}
} catch (UnknownHostException e) {
logger.error(getClass().getName() + " Exception!", e);
}
// If no connection found, let's ask the user to define it.
......
This diff is collapsed.
......@@ -5,6 +5,9 @@ Bundle-SymbolicName: org.eclipse.ice.vibe;singleton:=true
Bundle-Version: 2.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.ice.io.serializable,
org.eclipse.jface.dialogs,
org.eclipse.swt.widgets,
org.eclipse.ui,
org.osgi.framework;version="1.3.0",
org.slf4j;version="1.7.2"
Bundle-ActivationPolicy: lazy
......
......@@ -19,6 +19,8 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.datastructures.entry.DiscreteEntry;
import org.eclipse.ice.datastructures.entry.IEntry;
......@@ -29,6 +31,10 @@ import org.eclipse.ice.io.serializable.IIOService;
import org.eclipse.ice.io.serializable.IOService;
import org.eclipse.ice.io.serializable.IReader;
import org.eclipse.ice.item.jobLauncher.JobLauncher;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
/**
* <p>
......@@ -113,10 +119,12 @@ public class VibeLauncher extends JobLauncher {
@Override
public void setupForm() {
String copyCase = "cp -r ${installDir}vibe/examples/case6/* .;";
String fixSIMROOT = "sed -i.bak 's?SIM_ROOT=.*?" + "SIM_ROOT='`pwd`'?g' ${inputFile};";
String fixSIMROOT = "sed -i.bak 's?SIM_ROOT=.*?"
+ "SIM_ROOT='`pwd`'?g' ${inputFile};";
// Setup the VIBE launch script
String VIBEExec = "${installDir}ipsframework-code/install/bin/ips.py" + " -a --log=temp.log --platform="
+ IPS_ROOT + "/workstation.conf --simulation=${inputFile};";
String VIBEExec = "${installDir}ipsframework-code/install/bin/ips.py"
+ " -a --log=temp.log --platform=" + IPS_ROOT
+ "/workstation.conf --simulation=${inputFile};";
// Setup the command stages. An explicit forward slash is used here, so
// will only work on linux for now.
fullExecCMD = copyCase + fixSIMROOT + VIBEExec;
......@@ -137,12 +145,14 @@ public class VibeLauncher extends JobLauncher {
entry.setValue("false");
entry.setName("Use custom key-value pair file?");
entry.setTag("MODE");
entry.setDescription("Allows the use of a customized KV Pair file generated by ICE");
entry.setDescription(
"Allows the use of a customized KV Pair file generated by ICE");
// Add the selector to the form && make it listen for changes
DataComponent fileComponent = (DataComponent) form.getComponent(1);
fileComponent.addEntry(entry);
fileComponent.retrieveEntry("Use custom key-value pair file?").register(this);
fileComponent.retrieveEntry("Use custom key-value pair file?")
.register(this);
form.removeComponent(1);
form.addComponent(fileComponent);
update(fileComponent.retrieveEntry("Use custom key-value pair file?"));
......@@ -163,10 +173,11 @@ public class VibeLauncher extends JobLauncher {
@Override
public FormStatus process(String actionName) {
IReader reader = (IReader) ioService.getReader("IPS");
IReader reader = ioService.getReader("IPS");
DataComponent fileComponent = (DataComponent) form.getComponent(1);
IEntry inputFileEntry = fileComponent.retrieveEntry("Input File");
IEntry kvPairFileEntry = fileComponent.retrieveEntry("Use custom key-value pair file?");
IEntry kvPairFileEntry = fileComponent
.retrieveEntry("Use custom key-value pair file?");
IFile inputFile = project.getFile(inputFileEntry.getValue());
// Get the Run ID that may be used to locate the simulation files
......@@ -179,7 +190,8 @@ public class VibeLauncher extends JobLauncher {
// Get the Case Name which may also be used to locate the simulation
// files
String caseName = "";
ArrayList<IEntry> caseNameMatches = reader.findAll(inputFile, "SIM_NAME=.*");
ArrayList<IEntry> caseNameMatches = reader.findAll(inputFile,
"SIM_NAME=.*");
if (caseNameMatches != null && !caseNameMatches.isEmpty()) {
caseName = caseNameMatches.get(0).getName().split("=")[1];
}
......@@ -191,16 +203,41 @@ public class VibeLauncher extends JobLauncher {
// Get the base path for the simulation files
String dataDir = "";
ArrayList<IEntry> simRootMatches = reader.findAll(inputFile, "SIM_ROOT=.*");
ArrayList<IEntry> simRootMatches = reader.findAll(inputFile,
"SIM_ROOT=.*");
if (simRootMatches != null && !simRootMatches.isEmpty()) {
dataDir = simRootMatches.get(0).getName().split("=")[1];
}
// TODO Check if it is ever valid for one of these to be empty but not
// the other. Change from AND to OR if not.
// Check if a case is specified in the input file. Create an error
// dialog if not.
if (dataDir.isEmpty() && caseName.isEmpty()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
ErrorDialog.openError(new Shell(Display.getDefault()),
"Error Reading VIBE Input File",
"SIM not specified in input.",
new Status(IStatus.ERROR,
"org.eclipse.ice.vibe.launcher",
"Required attributes SIM_NAME and SIM_ROOT are "
+ "not specified in input file."));
return;
}
});
return FormStatus.InfoError;
}
if (dataDir.endsWith("/$SIM_NAME")) {
dataDir = dataDir.substring(0, dataDir.length() - 10);
} else if (dataDir.endsWith("${SIM_NAME}")) {
dataDir = dataDir.substring(0, dataDir.length() - 12);
} else if (dataDir.endsWith(caseName)) {
dataDir = dataDir.substring(0, dataDir.length() - (caseName.length() + 1));
dataDir = dataDir.substring(0,
dataDir.length() - (caseName.length() + 1));
}
// If we are supplying a new KV Pair file replace it in the input file
......@@ -209,7 +246,8 @@ public class VibeLauncher extends JobLauncher {
String backupKVFile = "";
String mvKVPairFile = "";
if (kvPairFileEntry.getValue() != "false") {
String kvFileName = fileComponent.retrieveEntry("Key-value pair file").getValue();
String kvFileName = fileComponent
.retrieveEntry("Key-value pair file").getValue();
// writer.replace(inputFile, "input_keyvalue", kvFileName);
setKVPerms = "chmod 775 " + kvFileName + " && ";
backupKVFile = "mv input/input_keyvalue input/input_keyvalue.bak && ";
......@@ -221,14 +259,19 @@ public class VibeLauncher extends JobLauncher {
CAEBAT_ROOT = hostTable.getRow(0).get(2).getValue();
// Set up the execution command
String exportRoot = "export CAEBAT_ROOT=" + CAEBAT_ROOT + "/vibe/components && ";
String exportRoot = "export CAEBAT_ROOT=" + CAEBAT_ROOT
+ "/vibe/components && ";
String copyCase = "cp -r " + dataDir + "/" + caseName + "/* . && ";
String fixSIMROOT = "sed -i.bak 's?SIM_ROOT\\ *=\\ *.*?" + "SIM_ROOT\\ =\\ '`pwd`'?g' ${inputFile} && ";
String fixSIMROOT = "sed -i.bak 's?SIM_ROOT\\ *=\\ *.*?"
+ "SIM_ROOT\\ =\\ '`pwd`'?g' ${inputFile} && ";
// The main execution of the simulation.
String VIBEExec = "${installDir}ipsframework-code/install/bin/ips.py" + " -a --log=temp.log --platform="
+ CAEBAT_ROOT + "/vibe/examples/config/batsim.conf" + " --simulation=${inputFile}; ";
fullExecCMD = exportRoot + copyCase + setKVPerms + backupKVFile + mvKVPairFile + fixSIMROOT + VIBEExec;
String VIBEExec = "${installDir}ipsframework-code/install/bin/ips.py"
+ " -a --log=temp.log --platform=" + CAEBAT_ROOT
+ "/vibe/examples/config/batsim.conf"
+ " --simulation=${inputFile}; ";
fullExecCMD = exportRoot + copyCase + setKVPerms + backupKVFile
+ mvKVPairFile + fixSIMROOT + VIBEExec;
// Setup the executable information
setExecutable(getName(), getDescription(), this.fullExecCMD);
......@@ -246,11 +289,14 @@ public class VibeLauncher extends JobLauncher {
if (component instanceof IEntry) {
// Determine whether the file selector needs to be added to or
// removed from the form
if (component.getName() == "Use custom key-value pair file?" && ((IEntry) component).getValue() == "true") {
addInputType("Key-value pair file", "keyValueFile", "Key-value pair with case parameters", ".dat");
if (component.getName() == "Use custom key-value pair file?"
&& ((IEntry) component).getValue() == "true") {
addInputType("Key-value pair file", "keyValueFile",
"Key-value pair with case parameters", ".dat");
} else if (component.getName() == "Use custom key-value pair file?"
&& ((IEntry) component).getValue() == "false") {
DataComponent fileComponent = (DataComponent) form.getComponent(1);
DataComponent fileComponent = (DataComponent) form
.getComponent(1);
fileComponent.deleteEntry("Key-value pair file");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment