Skip to content
This repository was archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Change defaults for controllerw
Browse files Browse the repository at this point in the history
  • Loading branch information
daveol committed Oct 31, 2018
1 parent 0254a6e commit 5cd04f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ enablePlugins(PackPlugin)

name := "NetLogo-HPC"
organization := "nl.tudelft.tbm"
version := "0.1.1"
version := "0.1.2"

resolvers += Resolver.bintrayRepo("netlogo", "NetLogo-JVM")
resolvers += "sim0mq Public Repository" at "http://sim0mq.org/maven"
Expand Down
12 changes: 8 additions & 4 deletions src/main/scala/nl/tudelft/tbm/netlogo_hpc/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ object Main {
var workerRole: Boolean = Properties.envOrElse("NETLOGO_WORKER", "false").toBoolean
/* network settings */
var listen: Boolean = Properties.envOrElse("NETLOGO_LISTEN", "false").toBoolean
var uri: String = Properties.envOrElse("NETLOGO_URI", s"tcp://${InetAddress.getLocalHost.getHostAddress}:*")
var uri: String = Properties.envOrElse("NETLOGO_URI", s"tcp://${InetAddress.getLocalHost.getHostAddress}")
var clientId: String = Properties.envOrElse("NETLOGO_CLIENT_ID", randomUUID().toString)
var applicationId: String = Properties.envOrElse("NETLOGO_APP_ID", randomUUID().toString)




val iterator = args.iterator
while (iterator.hasNext) {
iterator.next() match {
Expand All @@ -52,6 +49,7 @@ object Main {
case "--controller" => {
clientId = "controller"
controllerRole = true
listen = true
}
case "--table" => table = Some(Util.nextOrExit(iterator, "--table"))
/* worker settings */
Expand Down Expand Up @@ -116,6 +114,11 @@ object Main {
System.exit(1)
}

if (experiment.isEmpty) {
logger.error("Netlogo experiment is not specified")
System.exit(1)
}

if (table.isEmpty) {
logger.error("NetLogo table file is not given")
System.exit(1)
Expand All @@ -128,6 +131,7 @@ object Main {

val networkThread = new Thread(connection)
networkThread.start()
Thread.sleep(1000)

if (workerRole) {
val worker = new Worker(connection, modelFile, experiment.get, tableFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ NetworkConnection(

if (listen) {
/* open socket for listening */
socket.bind(uri)
socket.bindToRandomPort(uri)
} else {
/* open socket for connecting */
logger.debug(s"Connecting to $uri")
Expand Down

0 comments on commit 5cd04f8

Please # to comment.