Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
openmole
openmole
Commits
c5abfa63
Commit
c5abfa63
authored
Jul 09, 2021
by
Romain Reuillon
Browse files
[Plugin] enh: fix version in python and julia tasks
parent
b5b8564c
Pipeline
#1203
failed with stages
in 11 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
openmole/bin/org.openmole.marketindex/src/main/scala/org/openmole/marketindex/Market.scala
View file @
c5abfa63
...
...
@@ -38,6 +38,7 @@ object Market {
lazy
val
simulation
=
Tag
(
"Simulation"
)
lazy
val
machineLearning
=
Tag
(
"Machine Learning"
)
lazy
val
R
=
Tag
(
"R"
)
lazy
val
julia
=
Tag
(
"Julia"
)
lazy
val
scilab
=
Tag
(
"Scilab"
)
lazy
val
fsl
=
Tag
(
"FSL"
)
lazy
val
neuroscience
=
Tag
(
"Neuro Science"
)
...
...
@@ -77,6 +78,7 @@ object Market {
MarketEntry
(
"Hello World in Scilab"
,
"scilab-hello"
,
Seq
(
scilab
)),
MarketEntry
(
"Hello World in Java"
,
"java-hello"
,
Seq
(
java
)),
MarketEntry
(
"Hello World in NetLogo"
,
"fire"
,
Seq
(
netlogo
,
stochastic
,
simulation
)),
MarketEntry
(
"Hello World in Julia"
,
"julia-helo"
,
Seq
(
julia
)),
MarketEntry
(
"Hello World in GAMA"
,
"gama"
,
Seq
(
gama
,
stochastic
,
simulation
)),
MarketEntry
(
"Hello World in a Container"
,
"hello-container"
,
Seq
(
native
)),
MarketEntry
(
"Hello with OpenMOLE plugin"
,
"hello-plugin"
,
Seq
(
scala
,
java
,
plugin
)),
...
...
openmole/plugins/org.openmole.plugin.task.julia/src/main/scala/org/openmole/plugin/task/julia/JuliaTask.scala
View file @
c5abfa63
...
...
@@ -30,42 +30,43 @@ object JuliaTask {
implicit
def
isInfo
=
InfoBuilder
(
info
)
implicit
def
isMapped
=
MappedInputOutputBuilder
(
JuliaTask
.
mapped
)
def
installCommands
(
install
:
Seq
[
String
],
libraries
:
Seq
[
String
])
:
Vector
[
String
]
=
{
(
install
++
Seq
(
"""julia -e 'using Pkg; Pkg.add.([ """
+
libraries
.
map
{
l
⇒
"\""
+
l
+
"\""
}.
mkString
(
","
)+
"""])'"""
)).
toVector
}
def
installCommands
(
install
:
Seq
[
String
],
libraries
:
Seq
[
String
])
:
Vector
[
String
]
=
{
(
install
++
Seq
(
"""julia -e 'using Pkg; Pkg.add.([ """
+
libraries
.
map
{
l
⇒
"\""
+
l
+
"\""
}.
mkString
(
","
)+
"""])'"""
)).
toVector
}
def
apply
(
script
:
RunnableScript
,
arguments
:
OptionalArgument
[
String
]
=
None
,
libraries
:
Seq
[
String
]
=
Seq
.
empty
,
install
:
Seq
[
String
]
=
Seq
.
empty
,
workDirectory
:
OptionalArgument
[
String
]
=
None
,
hostFiles
:
Seq
[
HostFile
]
=
Vector
.
empty
,
environmentVariables
:
Seq
[
EnvironmentVariable
]
=
Vector
.
empty
,
errorOnReturnValue
:
Boolean
=
true
,
returnValue
:
OptionalArgument
[
Val
[
Int
]]
=
None
,
stdOut
:
OptionalArgument
[
Val
[
String
]]
=
None
,
stdErr
:
OptionalArgument
[
Val
[
String
]]
=
None
,
containerSystem
:
ContainerSystem
=
ContainerSystem
.
default
,
installContainerSystem
:
ContainerSystem
=
ContainerSystem
.
default
)(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
,
newFile
:
TmpDirectory
,
workspace
:
Workspace
,
preference
:
Preference
,
fileService
:
FileService
,
threadProvider
:
ThreadProvider
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
serializerService
:
SerializerService
)
=
{
new
JuliaTask
(
script
=
script
,
arguments
=
arguments
.
option
,
image
=
ContainerTask
.
prepare
(
installContainerSystem
,
DockerImage
(
"julia"
),
installCommands
(
install
,
Seq
(
"JSON"
)++
libraries
)),
errorOnReturnValue
=
errorOnReturnValue
,
returnValue
=
returnValue
,
stdOut
=
stdOut
,
stdErr
=
stdErr
,
hostFiles
=
hostFiles
,
environmentVariables
=
environmentVariables
,
containerSystem
=
containerSystem
,
config
=
InputOutputConfig
(),
external
=
External
(),
info
=
InfoConfig
(),
mapped
=
MappedInputOutputConfig
()
)
set
(
outputs
+=
(
Seq
(
returnValue
.
option
,
stdOut
.
option
,
stdErr
.
option
).
flatten
:
_
*
))
}
def
apply
(
script
:
RunnableScript
,
arguments
:
OptionalArgument
[
String
]
=
None
,
libraries
:
Seq
[
String
]
=
Seq
.
empty
,
install
:
Seq
[
String
]
=
Seq
.
empty
,
version
:
String
=
"1.6.1"
,
workDirectory
:
OptionalArgument
[
String
]
=
None
,
hostFiles
:
Seq
[
HostFile
]
=
Vector
.
empty
,
environmentVariables
:
Seq
[
EnvironmentVariable
]
=
Vector
.
empty
,
errorOnReturnValue
:
Boolean
=
true
,
returnValue
:
OptionalArgument
[
Val
[
Int
]]
=
None
,
stdOut
:
OptionalArgument
[
Val
[
String
]]
=
None
,
stdErr
:
OptionalArgument
[
Val
[
String
]]
=
None
,
containerSystem
:
ContainerSystem
=
ContainerSystem
.
default
,
installContainerSystem
:
ContainerSystem
=
ContainerSystem
.
default
)(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
,
newFile
:
TmpDirectory
,
workspace
:
Workspace
,
preference
:
Preference
,
fileService
:
FileService
,
threadProvider
:
ThreadProvider
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
serializerService
:
SerializerService
)
=
{
new
JuliaTask
(
script
=
script
,
arguments
=
arguments
.
option
,
image
=
ContainerTask
.
prepare
(
installContainerSystem
,
DockerImage
(
"julia"
,
version
),
installCommands
(
install
,
Seq
(
"JSON"
)++
libraries
)),
errorOnReturnValue
=
errorOnReturnValue
,
returnValue
=
returnValue
,
stdOut
=
stdOut
,
stdErr
=
stdErr
,
hostFiles
=
hostFiles
,
environmentVariables
=
environmentVariables
,
containerSystem
=
containerSystem
,
config
=
InputOutputConfig
(),
external
=
External
(),
info
=
InfoConfig
(),
mapped
=
MappedInputOutputConfig
()
)
set
(
outputs
+=
(
Seq
(
returnValue
.
option
,
stdOut
.
option
,
stdErr
.
option
).
flatten
:
_
*
))
}
}
@Lenses
case
class
JuliaTask
(
...
...
openmole/plugins/org.openmole.plugin.task.python/src/main/scala/org/openmole/plugin/task/python/PythonTask.scala
View file @
c5abfa63
...
...
@@ -27,49 +27,52 @@ object PythonTask {
implicit
def
isInfo
=
InfoBuilder
(
info
)
implicit
def
isMapped
=
MappedInputOutputBuilder
(
PythonTask
.
mapped
)
// could to make distinct image for python 2 and 3
def
dockerImage
(
major
:
Int
)
=
DockerImage
(
"python"
)
def
dockerImage
(
version
:
String
)
=
DockerImage
(
"python"
,
version
)
def
installCommands
(
install
:
Seq
[
String
],
libraries
:
Seq
[
String
],
major
:
Int
)
:
Vector
[
String
]
=
{
// need to install pip2 in case of python 2
val
effintsall
=
install
++
(
if
(
major
==
2
)
Seq
(
"curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"
,
"python2 get-pip.py"
)
else
Seq
.
empty
)
(
effintsall
++
libraries
.
map
{
l
⇒
"pip"
+
major
+
" install "
+
l
}).
toVector
}
def
installCommands
(
install
:
Seq
[
String
],
libraries
:
Seq
[
String
],
major
:
Int
)
:
Vector
[
String
]
=
{
// need to install pip2 in case of python 2
val
effintsall
=
install
++
(
if
(
major
==
2
)
Seq
(
"curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"
,
"python2 get-pip.py"
)
else
Seq
.
empty
)
def
apply
(
script
:
RunnableScript
,
arguments
:
OptionalArgument
[
String
]
=
None
,
major
:
Int
=
3
,
libraries
:
Seq
[
String
]
=
Seq
.
empty
,
install
:
Seq
[
String
]
=
Seq
.
empty
,
workDirectory
:
OptionalArgument
[
String
]
=
None
,
hostFiles
:
Seq
[
HostFile
]
=
Vector
.
empty
,
environmentVariables
:
Seq
[
EnvironmentVariable
]
=
Vector
.
empty
,
errorOnReturnValue
:
Boolean
=
true
,
returnValue
:
OptionalArgument
[
Val
[
Int
]]
=
None
,
stdOut
:
OptionalArgument
[
Val
[
String
]]
=
None
,
stdErr
:
OptionalArgument
[
Val
[
String
]]
=
None
,
containerSystem
:
ContainerSystem
=
ContainerSystem
.
default
,
installContainerSystem
:
ContainerSystem
=
ContainerSystem
.
default
)(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
,
newFile
:
TmpDirectory
,
workspace
:
Workspace
,
preference
:
Preference
,
fileService
:
FileService
,
threadProvider
:
ThreadProvider
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
serializerService
:
SerializerService
)
=
{
new
PythonTask
(
script
=
script
,
arguments
=
arguments
.
option
,
image
=
ContainerTask
.
prepare
(
installContainerSystem
,
dockerImage
(
major
),
installCommands
(
install
,
libraries
,
major
)),
errorOnReturnValue
=
errorOnReturnValue
,
returnValue
=
returnValue
,
stdOut
=
stdOut
,
stdErr
=
stdErr
,
hostFiles
=
hostFiles
,
environmentVariables
=
environmentVariables
,
containerSystem
=
containerSystem
,
config
=
InputOutputConfig
(),
external
=
External
(),
info
=
InfoConfig
(),
mapped
=
MappedInputOutputConfig
(),
major
=
major
)
set
(
outputs
+=
(
Seq
(
returnValue
.
option
,
stdOut
.
option
,
stdErr
.
option
).
flatten
:
_
*
))
}
(
effintsall
++
libraries
.
map
{
l
⇒
"pip"
+
major
+
" install "
+
l
}).
toVector
}
def
apply
(
script
:
RunnableScript
,
arguments
:
OptionalArgument
[
String
]
=
None
,
version
:
String
=
"3.9.6"
,
libraries
:
Seq
[
String
]
=
Seq
.
empty
,
install
:
Seq
[
String
]
=
Seq
.
empty
,
workDirectory
:
OptionalArgument
[
String
]
=
None
,
hostFiles
:
Seq
[
HostFile
]
=
Vector
.
empty
,
environmentVariables
:
Seq
[
EnvironmentVariable
]
=
Vector
.
empty
,
errorOnReturnValue
:
Boolean
=
true
,
returnValue
:
OptionalArgument
[
Val
[
Int
]]
=
None
,
stdOut
:
OptionalArgument
[
Val
[
String
]]
=
None
,
stdErr
:
OptionalArgument
[
Val
[
String
]]
=
None
,
containerSystem
:
ContainerSystem
=
ContainerSystem
.
default
,
installContainerSystem
:
ContainerSystem
=
ContainerSystem
.
default
)(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
,
newFile
:
TmpDirectory
,
workspace
:
Workspace
,
preference
:
Preference
,
fileService
:
FileService
,
threadProvider
:
ThreadProvider
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
serializerService
:
SerializerService
)
=
{
val
major
=
if
(
version
.
startsWith
(
"2"
))
2
else
3
new
PythonTask
(
script
=
script
,
arguments
=
arguments
.
option
,
image
=
ContainerTask
.
prepare
(
installContainerSystem
,
dockerImage
(
version
),
installCommands
(
install
,
libraries
,
major
)),
errorOnReturnValue
=
errorOnReturnValue
,
returnValue
=
returnValue
,
stdOut
=
stdOut
,
stdErr
=
stdErr
,
hostFiles
=
hostFiles
,
environmentVariables
=
environmentVariables
,
containerSystem
=
containerSystem
,
config
=
InputOutputConfig
(),
external
=
External
(),
info
=
InfoConfig
(),
mapped
=
MappedInputOutputConfig
(),
major
=
major
)
set
(
outputs
+=
(
Seq
(
returnValue
.
option
,
stdOut
.
option
,
stdErr
.
option
).
flatten
:
_
*
))
}
}
@Lenses
case
class
PythonTask
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment