Hi all,
Today I'm trying to run an R script that embeds and command NetLogo. It seems tricky to configure with Care and I need a hand ...

first of all OpenMole send me that :

org.openmole.core.exception.InternalProcessingError: Error for context values in CARETask@-208567776 {i=10, oMSeed=-1969014527224670348} at org.openmole.core.workflow.tools.InputOutputCheck$class.perform(InputOutputCheck.scala:94)
        at org.openmole.plugin.task.care.CARETask.perform(CARETask.scala:71)
        at org.openmole.core.workflow.task.Task$class.perform(Task.scala:59)
        at org.openmole.plugin.task.care.CARETask.perform(CARETask.scala:71)
        at org.openmole.core.workflow.job.MoleJob.perform(MoleJob.scala:102)
at org.openmole.core.workflow.execution.local.LocalExecutor$$anonfun$1$$anonfun$apply$1.apply(LocalExecutor.scala:82) at org.openmole.core.workflow.execution.local.LocalExecutor$$anonfun$1$$anonfun$apply$1.apply(LocalExecutor.scala:64)
        at scala.collection.immutable.List.foreach(List.scala:381)
at org.openmole.core.workflow.execution.local.LocalExecutor$$anonfun$1.apply(LocalExecutor.scala:64) at org.openmole.core.workflow.execution.local.LocalExecutor$$anonfun$1.apply(LocalExecutor.scala:61) at org.openmole.core.output.OutputManager$.withStreamOutputs(OutputManager.scala:99) at org.openmole.core.workflow.execution.local.LocalExecutor.withRedirectedOutput(LocalExecutor.scala:128) at org.openmole.core.workflow.execution.local.LocalExecutor.run(LocalExecutor.scala:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.openmole.core.exception.InternalProcessingError: Error executing command": [./re-execute.sh R --slave -f netlogo_run.R --args 10] return code was not 0 but 1 at org.openmole.plugin.task.care.CARETask$$anonfun$process$1.apply(CARETask.scala:159) at org.openmole.plugin.task.care.CARETask$$anonfun$process$1.apply(CARETask.scala:93) at org.openmole.plugin.task.external.External.withWorkDir(External.scala:176)
        at org.openmole.plugin.task.care.CARETask.process(CARETask.scala:93)
at org.openmole.core.workflow.task.Task$$anonfun$perform$1.apply(Task.scala:59) at org.openmole.core.workflow.task.Task$$anonfun$perform$1.apply(Task.scala:59) at org.openmole.core.workflow.tools.InputOutputCheck$class.perform(InputOutputCheck.scala:91)
        ... 13 more

In attachment you can find my oms file and my script R .

Someone has ever played in this situation ?
--
Cordialement

Etienne DELAY
Chaire: Capital environnemental et gestion durable des cours d'eau
laboratoire GEOLAB UMR 6042 CNRS
Université de Limoges, FLSH
39E rue Camille Guérin 87036 Limoges
blog : http://elcep.legtux.org
## ce script va lire le plan d'expérience générer par netlogo_setup.R
## et lancer netlogo avec les jeux de paramètres qui vont bien 

##le script prend un argement en entré qui est le numéro de la ligne à lancer en paramètre dans netlogo
args<-commandArgs(trailingOnly = TRUE)
#args <- 376

suppressPackageStartupMessages(library(RNetLogo, quietly = TRUE, warn.conflicts = TRUE))

explor.nl <- read.csv("nlogo/data/table_experience.csv", header =T) 

#localisaer l'installation de netlogo
nl.path <- "/home/delaye/github/projet42/netlogo-5.3.1-64/app/"
NLStart(nl.path, gui = FALSE) #lance netlogo avec (TRUE) ou non (FALSE) une gui

##Definition du chemin du modèle
model.path <- "../../nlogo/model_o_coopVSvariability.nlogo"
## chargement du modele dans netlogo
NLLoadModel(model.path)


my.row <- explor.nl[args,]
##definition des variables
this.run <- as.numeric(my.row[,1])
this.agent.map <- paste('\"data/maps_agents/',my.row[,2],'\"',sep = "")
this.space.map <- paste('\"data/maps_space/',my.row[,6],'\"',sep = "")
this.timeV <- as.numeric(my.row[,3])
this.diff.rate <- as.numeric(my.row[,4])
this.alpha <- as.numeric(my.row[,5])
this.hetero.sugar <- my.row[,7]


##Maping dans netlogo
NLCommand("set file_map_agents ", this.agent.map)
NLCommand("set file_map_space ", this.space.map)

NLCommand("set timeV ", this.timeV)
NLCommand("set diffuse-rate ", this.diff.rate)
NLCommand("set alpha ", this.alpha)
NLCommand("set heterogResugar? ", this.hetero.sugar)


NLCommand("setup")
agent.df<- data.frame()
j <- 0
for(i in 1:2000){
  NLCommand("go")
  if(j >= 10){
    pos.agents <- NLGetAgentSet(c("who","xcor", "ycor","size","color",
                                  "ticks"), "turtles")
    pos.agents$Args <- args
    agent.df <- rbind(agent.df , pos.agents)
    j = 1
  }
  j <- j + 1
  
}

#save(agent.df, file=paste("/home/delaye/simu",args,".RData", sep = ""))

save(agent.df, file = "../../simulation.RData")

NLQuit()
val i = Val[Int]
val output = Val[File]


val rTask = CARETask(workDirectory / "r_run_netlogo.tar.gz.bin", "R  --slave -f 
netlogo_run.R --args ${i}") set(
  inputs += i,
  outputs += i,
  outputFiles += ("../../simulation.RData", output) //take the 'result.csv' 
created by myscript.R  and put in output variable
  )

val copyHook = CopyFileHook(output, workDirectory / 
"resultats/simu_${i}.RData") // a kind of function that thke output of each 
execution and write it in a CSV file

val exploration = ExplorationTask(i in (1 to 12))
val env = LocalEnvironment(6) //defined number of thread used by the mole
exploration -< (rTask hook copyHook on env)
_______________________________________________
OpenMOLE-users mailing list
[email protected]
http://fedex.iscpif.fr/mailman/listinfo/openmole-users

Reply via email to