SystemExecTask: use inputs of the task in the command line


(Samuel Thiriot) #1

Hello !

I’ve a system task which runs a command (here, a R script which generates a network).

val generateNetworkTask =
  SystemExecTask("Rscript generate_net.R 2000 0.1 4") set (
    resources += workDirectory / "generate_net.R",
    stdOut := outputGenerateNetworkTask,
    stdErr := errorGenerateNetworkTask
  )

I would like to be able to explore the space of the parameters of this script. How can I inject the inputs of the SystemExecTask into the command line? Or maybe it’s not possible with SystemExecTask, and I should use a Care task instead?

Thanks !

Sam.


(Jonathan Passerat Palmbach) #2

Hey Sam,

You can inject any OpenMOLE variable that is in input of your task using the ${myVariable} syntax directly in the command line calling your RScript in the SystemExecTask.


(Juste Raimbault) #3

Hi Samuel !

I guess you can replace the values of inputs in the SystemExec string :
SystemExecTask(“command1 ${variable1} ${variable2}”) set (
inputs += (variable1,variable2),

)

but if you run a R script, the best should be using the RTask : https://next.openmole.org/R.html

This new model in the market couples a NetLogoTask with a RTask :

best

Juste


(Samuel Thiriot) #4

Hey Jonathan,

perfect, thanks !

Sam.


(Samuel Thiriot) #5

Hello Juste,

thanks for pointing the Rtask, I missed this one! Better use directly RTask then.

Sam.