Commit f8f65a3d authored by Jean Meurice's avatar Jean Meurice
Browse files

Added Zookeeper flag

parent f0fa5738
Pipeline #115736 passed with stages
in 2 minutes and 53 seconds
@REM
@REM
@REM ******************************************************************************
@REM MontiCAR Modeling Family, www.se-rwth.de
@REM Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
@REM All rights reserved.
@REM
@REM This project is free software; you can redistribute it and/or
@REM modify it under the terms of the GNU Lesser General Public
@REM License as published by the Free Software Foundation; either
@REM version 3.0 of the License, or (at your option) any later version.
@REM This library is distributed in the hope that it will be useful,
@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@REM Lesser General Public License for more details.
@REM
@REM You should have received a copy of the GNU Lesser General Public
@REM License along with this project. If not, see <http://www.gnu.org/licenses/>.
@REM *******************************************************************************
@REM
@echo off @echo off
pushd .. pushd ..
call run.bat os=linux cpu_frequency=10000000 memory_frequency=1000000 cache_DL1=128,1,2 cache_IL1=128,1,2 cache_L2=1024,10,15 export debug=unsupported_syscalls call run.bat os=linux cpu_frequency=10000000 memory_frequency=1000000 cache_DL1=128,1,2 cache_IL1=128,1,2 cache_L2=1024,10,15 export debug=unsupported_syscalls
......
@REM
@REM
@REM ******************************************************************************
@REM MontiCAR Modeling Family, www.se-rwth.de
@REM Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
@REM All rights reserved.
@REM
@REM This project is free software; you can redistribute it and/or
@REM modify it under the terms of the GNU Lesser General Public
@REM License as published by the Free Software Foundation; either
@REM version 3.0 of the License, or (at your option) any later version.
@REM This library is distributed in the hope that it will be useful,
@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@REM Lesser General Public License for more details.
@REM
@REM You should have received a copy of the GNU Lesser General Public
@REM License along with this project. If not, see <http://www.gnu.org/licenses/>.
@REM *******************************************************************************
@REM
@echo off @echo off
pushd .. pushd ..
call run.bat test_real os=windows cpu_frequency=10000000 memory_frequency=1000000 cache_DL1=128,1,2 cache_IL1=128,1,2 cache_L2=1024,10,15 export call run.bat test_real os=windows cpu_frequency=10000000 memory_frequency=1000000 cache_DL1=128,1,2 cache_IL1=128,1,2 cache_L2=1024,10,15 export
......
@REM
@REM
@REM ******************************************************************************
@REM MontiCAR Modeling Family, www.se-rwth.de
@REM Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
@REM All rights reserved.
@REM
@REM This project is free software; you can redistribute it and/or
@REM modify it under the terms of the GNU Lesser General Public
@REM License as published by the Free Software Foundation; either
@REM version 3.0 of the License, or (at your option) any later version.
@REM This library is distributed in the hope that it will be useful,
@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@REM Lesser General Public License for more details.
@REM
@REM You should have received a copy of the GNU Lesser General Public
@REM License along with this project. If not, see <http://www.gnu.org/licenses/>.
@REM *******************************************************************************
@REM
@echo off @echo off
pushd .. pushd ..
call run.bat test_real os=windows cpu_frequency=10000000 memory_frequency=1000000 export call run.bat test_real os=windows cpu_frequency=10000000 memory_frequency=1000000 export
......
@REM
@REM
@REM ******************************************************************************
@REM MontiCAR Modeling Family, www.se-rwth.de
@REM Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
@REM All rights reserved.
@REM
@REM This project is free software; you can redistribute it and/or
@REM modify it under the terms of the GNU Lesser General Public
@REM License as published by the Free Software Foundation; either
@REM version 3.0 of the License, or (at your option) any later version.
@REM This library is distributed in the hope that it will be useful,
@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@REM Lesser General Public License for more details.
@REM
@REM You should have received a copy of the GNU Lesser General Public
@REM License along with this project. If not, see <http://www.gnu.org/licenses/>.
@REM *******************************************************************************
@REM
@echo off @echo off
pushd .. pushd ..
call run.bat os=windows no_time test_real call run.bat os=windows no_time test_real
......
@REM
@REM
@REM ******************************************************************************
@REM MontiCAR Modeling Family, www.se-rwth.de
@REM Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
@REM All rights reserved.
@REM
@REM This project is free software; you can redistribute it and/or
@REM modify it under the terms of the GNU Lesser General Public
@REM License as published by the Free Software Foundation; either
@REM version 3.0 of the License, or (at your option) any later version.
@REM This library is distributed in the hope that it will be useful,
@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@REM Lesser General Public License for more details.
@REM
@REM You should have received a copy of the GNU Lesser General Public
@REM License along with this project. If not, see <http://www.gnu.org/licenses/>.
@REM *******************************************************************************
@REM
@echo off @echo off
pushd .. pushd ..
call run.bat test_real os=windows cpu_frequency=1500000 memory_frequency=150000 cache_DL1=128,1,2 cache_IL1=128,1,2 cache_L2=1024,10,15 export call run.bat test_real os=windows cpu_frequency=1500000 memory_frequency=150000 cache_DL1=128,1,2 cache_IL1=128,1,2 cache_L2=1024,10,15 export
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
This folder contains a sample setup of the RMIModelServer using the HardwareEmulator. This folder contains a sample setup of the RMIModelServer using the HardwareEmulator.
This folder is used to perform a simple test including the HardwareEmulator. This folder is used to perform a simple maven test including the HardwareEmulator.
Autopilots can be added in the autopilots folder and loaded on the file using HardwareEmulator configuration. Autopilots can be added in the autopilots folder and loaded on the fly using HardwareEmulator configuration.
The demo folder contains examples that start the RMIModelServer with a default configuration that is added to The demo folder contains examples that start the RMIModelServer with a default configuration that is added to
every allocated autopilot. every allocated autopilot.
\ No newline at end of file
...@@ -23,5 +23,5 @@ ...@@ -23,5 +23,5 @@
call config.bat call config.bat
echo Starting RMIModelServer on port %PORT% with Autopilot folder: %AUTOPILOT_FOLDER% echo Starting RMIModelServer on port %PORT% with Autopilot folder: %AUTOPILOT_FOLDER%
java "-Djava.rmi.server.codebase=file:rmi-model-server.jar" "-Djava.rmi.server.hostname=127.0.0.1" -cp rmi-model-server.jar rwth.rmi.model.server.RMIServer %PORT% %AUTOPILOT_FOLDER% %* java "-Djava.rmi.server.codebase=file:rmi-model-server.jar" "-Djava.rmi.server.hostname=127.0.0.1" -cp rmi-model-server.jar rwth.rmi.model.server.RMIServer %PORT% %AUTOPILOT_FOLDER% --no-zookeeper %*
pause pause
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<groupId>montisim</groupId> <groupId>montisim</groupId>
<artifactId>rmi-model-server</artifactId> <artifactId>rmi-model-server</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>rmi-model-server</name> <name>rmi-model-server</name>
...@@ -179,6 +179,7 @@ ...@@ -179,6 +179,7 @@
<version>2.19.1</version> <version>2.19.1</version>
<configuration> <configuration>
<workingDirectory>${project.basedir}/install</workingDirectory> <workingDirectory>${project.basedir}/install</workingDirectory>
<argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
......
...@@ -22,6 +22,6 @@ ...@@ -22,6 +22,6 @@
pushd .. pushd ..
call mvn clean install -s "settings.xml" call mvn clean install -s "settings.xml"
cd target cd target
ren "rmi-model-server-1.0.1-SNAPSHOT-jar-with-dependencies.jar" "rmi-model-server.jar" ren "rmi-model-server-1.1.0-jar-with-dependencies.jar" "rmi-model-server.jar"
copy "rmi-model-server.jar" "..\install" copy "rmi-model-server.jar" "..\install"
popd popd
\ No newline at end of file
...@@ -34,6 +34,7 @@ import java.rmi.RemoteException; ...@@ -34,6 +34,7 @@ import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry; import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry; import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject; import java.rmi.server.UnicastRemoteObject;
import java.util.Arrays;
public class RMIServer { public class RMIServer {
...@@ -57,13 +58,18 @@ public class RMIServer { ...@@ -57,13 +58,18 @@ public class RMIServer {
return; return;
} }
String zoo_servers; boolean use_zookeeper = true;
zoo_servers = System.getenv("ZOO_SERVERS"); int configIndex = 2;
if (zoo_servers == null){ if (args.length >= 3){
zoo_servers = "localhost:2181"; if (args[2].equals("--no-zookeeper")){
use_zookeeper = false;
configIndex++;
System.out.println("Not using Zookeeper.");
}
} }
//ZkClient zk = new ZkClient(zoo_servers, 1000, 5000);
HardwareEmulatorInterface manager = new HardwareEmulatorInterface(args);
HardwareEmulatorInterface manager = new HardwareEmulatorInterface(args, configIndex);
String host = InetAddress.getLocalHost().getHostName(); String host = InetAddress.getLocalHost().getHostName();
int port = Integer.valueOf(args[0]); int port = Integer.valueOf(args[0]);
...@@ -74,18 +80,27 @@ public class RMIServer { ...@@ -74,18 +80,27 @@ public class RMIServer {
//bind the ModelManager to a stub, representing the remote object //bind the ModelManager to a stub, representing the remote object
registry.bind(MODEL_MANAGER, UnicastRemoteObject.exportObject(manager, port)); registry.bind(MODEL_MANAGER, UnicastRemoteObject.exportObject(manager, port));
//register(zk, host, port); if (use_zookeeper){
String zoo_servers;
zoo_servers = System.getenv("ZOO_SERVERS");
if (zoo_servers == null){
zoo_servers = "localhost:2181";
}
ZkClient zk = new ZkClient(zoo_servers, 1000, 5000);
register(zk, host, port);
Runtime.getRuntime().addShutdownHook(new Thread(){
@Override
public void run(){
unregister(zk, host, port);
}
});
}
System.out.println("RMIManager listening"); System.out.println("RMIManager listening");
} catch (RemoteException | AlreadyBoundException e) { } catch (RemoteException | AlreadyBoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
/*Runtime.getRuntime().addShutdownHook(new Thread(){
@Override
public void run(){
unregister(zk, host, port);
}
});*/
} }
public static boolean isPortAvailable(String portString) { public static boolean isPortAvailable(String portString) {
......
...@@ -27,10 +27,10 @@ import java.io.Serializable; ...@@ -27,10 +27,10 @@ import java.io.Serializable;
import rwth.rmi.model.server.interfaces.RMIManager; import rwth.rmi.model.server.interfaces.RMIManager;
public class HardwareEmulatorInterface implements RMIManager { public class HardwareEmulatorInterface implements RMIManager {
public HardwareEmulatorInterface(String[] args) { public HardwareEmulatorInterface(String[] args, int configIndex) {
super(); super();
String default_config = ""; String default_config = "";
for (int i = 2; i < args.length; i++){ for (int i = configIndex; i < args.length; i++){
default_config += args[i] + "\n"; default_config += args[i] + "\n";
} }
String libraryPath = args[1]; String libraryPath = args[1];
......
...@@ -30,7 +30,7 @@ public class HardwareEmulatorTest { ...@@ -30,7 +30,7 @@ public class HardwareEmulatorTest {
@Test @Test
public void basic_test(){ public void basic_test(){
System.out.println("Current test directory: " + System.getProperty("user.dir")); System.out.println("Current test directory: " + System.getProperty("user.dir"));
HardwareEmulatorInterface manager = new HardwareEmulatorInterface(new String[]{"10101", "autopilots"}); HardwareEmulatorInterface manager = new HardwareEmulatorInterface(new String[]{"10101", "autopilots"}, 2);
String querry = "get_available_autopilots\nget_available_threads"; String querry = "get_available_autopilots\nget_available_threads";
String res = manager.query(querry); String res = manager.query(querry);
...@@ -70,8 +70,8 @@ public class HardwareEmulatorTest { ...@@ -70,8 +70,8 @@ public class HardwareEmulatorTest {
//manager.start_tick(1000000); //manager.start_tick(1000000);
//manager.end_tick(); //manager.end_tick();
HashMap<String, Serializable> outputs = manager.old_execute(id, 1000000, inputs); HashMap<String, Serializable> outputs = manager.old_execute(id, 1000000, inputs);
//String emu_querry = manager.querry_autopilot(id, "get_avg_runtime"); String emu_querry = manager.query_autopilot(id, "get_avg_runtime");
//System.out.println("Emu querry: " + emu_querry); System.out.println("Emu querry: " + emu_querry);
//HashMap<String, Serializable> outputs = manager.get_outputs(id); //HashMap<String, Serializable> outputs = manager.get_outputs(id);
Assert.assertEquals("output count", outputs.size(), 3); Assert.assertEquals("output count", outputs.size(), 3);
for (HashMap.Entry<String, Serializable> entry : outputs.entrySet()) { for (HashMap.Entry<String, Serializable> entry : outputs.entrySet()) {
......
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