The @code{JuliaTask} relies on an underlying @code{ContainerTask}.
@h3{Arguments of the JuliaTask}
It takes the following arguments :
@ul
@li{@code{script} String or File, mandatory. The Python script to be executed.}
@li{@code{version} String, optional. The version of Julia to run.}
@li{@code{install} Sequence of strings, optional (default = empty). The commands to be executed prior to any Julia packages installation and script execution (to install libraries on the system).}
@li{@code{libraries} Sequence of strings, optional (default = empty). The name of Julia libraries that need to be installed before the script execution (note: as detailed below, installations are only achieved during the first execution of the script, and then stored in a docker image in cache. To force an update, use the @i{forceUpdate} argument).}
@li{@code{forceUpdate} Boolean, optional (default = false). Should the libraries installation be forced (to ensure an update for example). If true, the task will perform the installation (and thus the update) even if the library was already installed.}
@h2{Embedding a Julia script}
The toy Julia script for this test case is:
@code("""
numericaloutput = arg * 2
write(open("output.txt","w"),string("Hello world from Julia #",arg))
""")
@br
We save this to @i{hello.jl} and upload it in your OpenMOLE workspace.
You can then use the following script:
@br@br
@hl.openmole("""
// Declare the variable
val arg = Val[Int]
val arg2 = Val[Double]
val numericaloutput = Val[Int]
val fileoutput = Val[File]
// julia task
val juliaTask =
JuliaTask(workDirectory / "hello.jl") set (
inputs += arg.mapped,
inputs += arg2.mapped,
outputs += arg,
outputs += numericaloutput.mapped,
outputs += fileoutput mapped "output.txt"
)
val copy = CopyFileHook(fileoutput, workDirectory / "result/hello${arg}.txt")
val env = LocalEnvironment(2)
DirectSampling(
evaluation = juliaTask,
sampling = (arg in (0 to 10)) x (arg2 is 2.0)
) hook copy on env
""")
@br
Notions from OpenMOLE are reused in this example.
If you're not too familiar with @a("Environments", href := scale.file), @a("Groupings", href := scale.file + "#Grouping"), @a("Hooks", href := hook.file) or @a("Samplings", href := samplings.file), check the relevant sections of the documentation.
@@ -19,7 +19,7 @@ It takes the following arguments :
@ul
@li{@code{script} String or file, mandatory. The Python script to be executed.}
@li{@code{major} Int, optional (default = 3). Major version of Python to run - MUST be either 2 or 3.}
@li{@code{version} String, optional. The version of Python to run.}
@li{@code{install} Sequence of strings, optional (default = empty). The commands to be executed prior to any Python packages installation and script execution (to install libraries on the system).}
@li{@code{libraries} Sequence of strings, optional (default = empty). The name of Python libraries (through pip) that will be used by the script and need to be installed before (note: as detailed below, installations are only achieved during the first execution of the script, and then stored in a docker image in cache. To force an update, use the @i{forceUpdate} argument).}
@li{@code{forceUpdate} Boolean, optional (default = false). Should the libraries installation be forced (to ensure an update for example). If true, the task will perform the installation (and thus the update) even if the library was already installed.}