Run netlogo models with extensions


(Samuel Thiriot) #1

Hello Community!

I’m trying to run a netlogo model which makes use of an extension (here, the “nw” network extension). This extension is bundled with netlogo 5 or 6.

At runtime, I’ve an error which sounds like the extension was not found by netlogo (see below).

As far as I know for Netlogo extensions, we might add netlogo extensions in the current directory (of netlogo).
I’m relying on that doc: https://github.com/NetLogo/NetLogo/wiki/Controlling-API#current-working-directory

Do you have an idea on how to use an extension?

tks !

Caused by: org.openmole.core.exception.UserBadDataError: Error while opening the file /home/sam/.openmole/sam440/.tmp/6930614e-d632-4a99-bfdc-d5fad0965ba6/execution821fc1f8-1229-4534-8672-fa902872e1c8/externalTaskeba2a2f4-ad98-48c0-bdbb-17632ad58393/model.nlogo:
| Can’t find extension: nw at position 12 in
| at org.nlogo.core.ErrorSource.signalError(ErrorSource.scala:11)
| at org.nlogo.workspace.ExtensionManager.importExtension(ExtensionManager.scala:184)
| at org.nlogo.parse.StructureParser$.$anonfun$parsingWithExtensions$1(StructureParser.scala:71)
| at org.nlogo.parse.StructureParser$.$anonfun$parsingWithExtensions$1$adapted(StructureParser.scala:69)
| at scala.collection.immutable.List.foreach(List.scala:378)
| at org.nlogo.parse.StructureParser$.parsingWithExtensions(StructureParser.scala:69)
| at org.nlogo.parse.StructureParser$.parseSources(StructureParser.scala:35)
| at org.nlogo.parse.NetLogoParser.basicParse(NetLogoParser.scala:17)
| at org.nlogo.parse.NetLogoParser.basicParse$(NetLogoParser.scala:15)
| at org.nlogo.parse.FrontEnd$.basicParse(FrontEnd.scala:10)
| at org.nlogo.parse.FrontEndMain.frontEnd(FrontEnd.scala:26)
| at org.nlogo.parse.FrontEndMain.frontEnd$(FrontEnd.scala:25)
| at org.nlogo.parse.FrontEnd$.frontEnd(FrontEnd.scala:10)
| at org.nlogo.compile.CompilerMain$.compile(CompilerMain.scala:42)
| at org.nlogo.compile.Compiler.compileProgram(Compiler.scala:50)
| at org.nlogo.headless.HeadlessModelOpener.openFromModel(HeadlessModelOpener.scala:49)
| at org.nlogo.headless.HeadlessWorkspace.openModel(HeadlessWorkspace.scala:535)
| at org.nlogo.headless.HeadlessWorkspace.open(HeadlessWorkspace.scala:502)
| at org.openmole.plugin.tool.netlogo6.NetLogo6.open(NetLogo6.java:49)
| at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$5(NetLogoTask.scala:79)
| at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
| at org.openmole.plugin.task.netlogo.NetLogoTask.wrapError(NetLogoTask.scala:54)
| at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$4(NetLogoTask.scala:79)
| at org.openmole.tool.thread.package$.withThreadClassLoader(package.scala:53)
| at org.openmole.core.code.CodePackage.withThreadClassLoader(CodePackage.scala:49)
| at org.openmole.core.code.CodePackage.withThreadClassLoader$(CodePackage.scala:48)
| at org.openmole.core.workflow.dsl$.withThreadClassLoader(package.scala:46)
| at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$2(NetLogoTask.scala:77)
| at org.openmole.plugin.task.external.External$.withWorkDir(External.scala:73)
| at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$1(NetLogoTask.scala:61)
| at org.openmole.core.expansion.FromContext$$anon$8.from(FromContext.scala:157)
| at org.openmole.core.workflow.tools.InputOutputCheck$.$anonfun$perform$1(InputOutputCheck.scala:88)
| at org.openmole.core.expansion.FromContext$$anon$9.from(FromContext.scala:163)
| at org.openmole.core.workflow.task.Task.perform(Task.scala:64)
| at org.openmole.core.workflow.task.Task.perform$(Task.scala:62)
| at org.openmole.plugin.task.netlogo6.NetLogo6Task.perform(NetLogo6Task.scala:110)
| at org.openmole.core.workflow.job.MoleJob.perform(MoleJob.scala:102)
| at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$2(LocalExecutor.scala:77)
| at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$2$adapted(LocalExecutor.scala:73)
| at scala.collection.Iterator.foreach(Iterator.scala:944)
| at scala.collection.Iterator.foreach$(Iterator.scala:944)
| at scala.collection.AbstractIterator.foreach(Iterator.scala:1432)
| at scala.collection.IterableLike.foreach(IterableLike.scala:71)
| at scala.collection.IterableLike.foreach$(IterableLike.scala:70)
| at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
| at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$1(LocalExecutor.scala:73)
| at org.openmole.core.outputmanager.OutputManager$.withStreamOutputs(OutputManager.scala:120)
| at org.openmole.core.workflow.execution.local.LocalExecutor.withRedirectedOutput(LocalExecutor.scala:127)
| at org.openmole.core.workflow.execution.local.LocalExecutor.run(LocalExecutor.scala:70)
| at java.lang.Thread.run(Thread.java:748)
at org.openmole.plugin.task.netlogo.NetLogoTask.wrapError(NetLogoTask.scala:57)
at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$4(NetLogoTask.scala:79)
at org.openmole.tool.thread.package$.withThreadClassLoader(package.scala:53)
at org.openmole.core.code.CodePackage.withThreadClassLoader(CodePackage.scala:49)
at org.openmole.core.code.CodePackage.withThreadClassLoader$(CodePackage.scala:48)
at org.openmole.core.workflow.dsl$.withThreadClassLoader(package.scala:46)
at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$2(NetLogoTask.scala:77)
at org.openmole.plugin.task.external.External$.withWorkDir(External.scala:73)
at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$1(NetLogoTask.scala:61)
at org.openmole.core.expansion.FromContext$$anon$8.from(FromContext.scala:157)
at org.openmole.core.workflow.tools.InputOutputCheck$.$anonfun$perform$1(InputOutputCheck.scala:88)
… 18 more

Sam.


(Samuel Thiriot) #2

The line pointed by the error message is the following one, first on the netlogo model

extensions [nw]


(Mathieu Leclaire) #3

Hi Samuel,

You should use embedWorkspace to pack all your extensions:
https://next.openmole.org/NetLogo.html

Mathieu


(Samuel Thiriot) #4

Hi Mathieu,

tks a lot, will try.

S.


(Samuel Thiriot) #5

Hi again,

thanks for the support, it works.

As it was about extension “nw”, I created a “nw” directory in openmole and uploaded the content of the corresponding netlogo extension, that is the nw.jar file as well as all the dependancies jars.

Tks !


(Aymericvie) #6

Hello @samthiriot,
I am encoutering a similar problem. I have followed your nice advice of having a nw directory and upload the .jar files inside. However it looks like the openmole script has not yet manage to correctly extract the nw extension.

Caused by: java.lang.NoClassDefFoundError: org/openide/util/Lookup

I had set embedworkspace to be true. Is there an additional procedure you made to ensure that the nw extension is well loaded?

Thank you very much in advance.
Best,
Aymeric Vié


#7

For some reason I didn’t see this thread. Could you try to add this: http://nextcloud.openmole.org/s/soAq8NMcED8yCzk along with your extension dir in the openmole workspace ?