Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openmole
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
RoiArthurB
openmole
Commits
b5769181
Commit
b5769181
authored
Apr 07, 2020
by
Romain Reuillon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Plugin] enh: implement clearContainerCache in GAMATask
parent
19de59e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
14 deletions
+29
-14
libraries/build.sbt
libraries/build.sbt
+1
-1
openmole/plugins/org.openmole.plugin.task.container/src/main/scala/org/openmole/plugin/task/container/ContainerTask.scala
...la/org/openmole/plugin/task/container/ContainerTask.scala
+13
-9
openmole/plugins/org.openmole.plugin.task.container/src/main/scala/org/openmole/plugin/task/container/package.scala
...in/scala/org/openmole/plugin/task/container/package.scala
+9
-0
openmole/plugins/org.openmole.plugin.task.gama/src/main/scala/org/openmole/plugin/task/gama/GAMATask.scala
...c/main/scala/org/openmole/plugin/task/gama/GAMATask.scala
+5
-3
openmole/project/Libraries.scala
openmole/project/Libraries.scala
+1
-1
No files found.
libraries/build.sbt
View file @
b5769181
...
...
@@ -235,7 +235,7 @@ lazy val mgo = OsgiProject(dir, "mgo", exports = Seq("mgo.*", "freestyle.*"), im
version
:=
mgoVersion
)
dependsOn
(
monocle
,
math
,
cats
,
squants
)
settings
(
settings
:
_
*
)
lazy
val
containerVersion
=
"1.1
0
"
lazy
val
containerVersion
=
"1.1
1
"
lazy
val
container
=
OsgiProject
(
dir
,
"container"
,
exports
=
Seq
(
"container.*"
),
imports
=
Seq
(
"!better.*"
,
"!javax.xml.*"
,
"!scala.meta.*"
,
"!sun.misc.*"
,
"!com.github.luben.*"
,
"!org.apache.avalon.*"
,
"!org.apache.log.*"
,
"!org.brotli.dec.*"
,
"!javax.*"
,
"*"
),
privatePackages
=
Seq
(
"!scala.*"
,
"!monocle.*"
,
"!org.apache.commons.math3.*"
,
"!cats.*"
,
"!squants.*"
,
"!scalaz.*"
,
"!io.circe.*"
,
"!shapeless.*"
,
"*"
))
settings
(
libraryDependencies
+=
"org.openmole"
%%
"container"
%
containerVersion
,
...
...
openmole/plugins/org.openmole.plugin.task.container/src/main/scala/org/openmole/plugin/task/container/ContainerTask.scala
View file @
b5769181
...
...
@@ -69,11 +69,7 @@ object ContainerTask {
import
_root_.container._
ImageDownloader
.
downloadContainerImage
(
_root_
.
container
.
RegistryImage
(
imageName
=
image
.
image
,
tag
=
image
.
tag
,
registry
=
image
.
registry
),
DockerImage
.
toRegistryImage
(
image
),
repository
,
timeout
=
preference
(
RegistryTimeout
),
retry
=
Some
(
preference
(
RegistryRetryOnError
)),
...
...
@@ -162,6 +158,7 @@ object ContainerTask {
stdOut
:
OptionalArgument
[
Val
[
String
]]
=
None
,
stdErr
:
OptionalArgument
[
Val
[
String
]]
=
None
,
reuseContainer
:
Boolean
=
true
,
clearCache
:
Boolean
=
false
,
containerPoolKey
:
CacheKey
[
WithInstance
[
_
root_.container.FlatImage
]]
=
CacheKey
())(
implicit
name
:
sourcecode.Name
,
definitionScope
:
DefinitionScope
,
tmpDirectory
:
TmpDirectory
,
networkService
:
NetworkService
,
workspace
:
Workspace
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
outputRedirection
:
OutputRedirection
,
serializerService
:
SerializerService
)
=
{
new
ContainerTask
(
containerSystem
,
...
...
@@ -184,7 +181,7 @@ object ContainerTask {
)
}
def
prepare
(
containerSystem
:
ContainerSystem
,
image
:
ContainerImage
,
install
:
Seq
[
String
],
volumes
:
Seq
[(
String
,
String
)]
=
Seq
.
empty
,
errorDetail
:
Int
⇒
Option
[
String
]
=
_
⇒
None
)(
implicit
tmpDirectory
:
TmpDirectory
,
serializerService
:
SerializerService
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
workspace
:
Workspace
)
=
{
def
prepare
(
containerSystem
:
ContainerSystem
,
image
:
ContainerImage
,
install
:
Seq
[
String
],
volumes
:
Seq
[(
String
,
String
)]
=
Seq
.
empty
,
errorDetail
:
Int
⇒
Option
[
String
]
=
_
⇒
None
,
clearCache
:
Boolean
=
false
)(
implicit
tmpDirectory
:
TmpDirectory
,
serializerService
:
SerializerService
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
workspace
:
Workspace
)
=
{
def
cacheId
(
image
:
ContainerImage
)
:
Seq
[
String
]
=
image
match
{
case
image
:
DockerImage
⇒
Seq
(
image.image
,
image.tag
,
image
.
registry
)
...
...
@@ -198,10 +195,16 @@ object ContainerTask {
val
serializedFlatImage
=
cacheDirectory
/
"flatimage.bin"
cacheDirectory
.
withLockInDirectory
{
val
containerDirectory
=
cacheDirectory
/
"fs"
if
(
clearCache
)
{
serializedFlatImage
.
delete
containerDirectory
.
recursiveDelete
}
if
(
serializedFlatImage
.
exists
)
serializerService
.
deserialize
[
_
root_.container.FlatImage
](
serializedFlatImage
)
else
{
val
containerDirectory
=
cacheDirectory
/
"fs"
val
img
=
localImage
(
image
,
containerDirectory
)
val
img
=
localImage
(
image
,
containerDirectory
,
clearCache
=
clearCache
)
val
installedImage
=
executeInstall
(
containerSystem
,
img
,
install
,
volumes
=
volumes
,
errorDetail
=
errorDetail
)
serializerService
.
serialize
(
installedImage
,
serializedFlatImage
)
installedImage
...
...
@@ -217,9 +220,10 @@ object ContainerTask {
image
}
def
localImage
(
image
:
ContainerImage
,
containerDirectory
:
File
)(
implicit
networkService
:
NetworkService
,
workspace
:
Workspace
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
tmpDirectory
:
TmpDirectory
)
=
def
localImage
(
image
:
ContainerImage
,
containerDirectory
:
File
,
clearCache
:
Boolean
)(
implicit
networkService
:
NetworkService
,
workspace
:
Workspace
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
tmpDirectory
:
TmpDirectory
)
=
image
match
{
case
image
:
DockerImage
⇒
if
(
clearCache
)
_
root_.container.ImageDownloader.imageDirectory
(
repositoryDirectory
(
workspace
),
DockerImage.toRegistryImage
(
image
)).
recursiveDelete
val
savedImage
=
downloadImage
(
image
,
repositoryDirectory
(
workspace
))
_root_
.
container
.
ImageBuilder
.
flattenImage
(
savedImage
,
containerDirectory
)
case
image
:
SavedDockerImage
⇒
...
...
openmole/plugins/org.openmole.plugin.task.container/src/main/scala/org/openmole/plugin/task/container/package.scala
View file @
b5769181
...
...
@@ -60,6 +60,15 @@ package container {
}
object
DockerImage
{
def
toRegistryImage
(
image
:
DockerImage
)
=
_root_
.
container
.
RegistryImage
(
name
=
image
.
image
,
tag
=
image
.
tag
,
registry
=
image
.
registry
)
}
sealed
trait
ContainerImage
case
class
DockerImage
(
image
:
String
,
tag
:
String
=
"latest"
,
registry
:
String
=
"https://registry-1.docker.io"
)
extends
ContainerImage
case
class
SavedDockerImage
(
file
:
java.io.File
,
compressed
:
Boolean
)
extends
ContainerImage
...
...
openmole/plugins/org.openmole.plugin.task.gama/src/main/scala/org/openmole/plugin/task/gama/GAMATask.scala
View file @
b5769181
...
...
@@ -46,7 +46,8 @@ object GAMATask {
experiment
:
String
,
install
:
Seq
[
String
],
installContainerSystem
:
ContainerSystem
,
version
:
String
)(
implicit
tmpDirectory
:
TmpDirectory
,
serializerService
:
SerializerService
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
_workspace
:
Workspace
)
=
{
version
:
String
,
clearCache
:
Boolean
)(
implicit
tmpDirectory
:
TmpDirectory
,
serializerService
:
SerializerService
,
outputRedirection
:
OutputRedirection
,
networkService
:
NetworkService
,
threadProvider
:
ThreadProvider
,
preference
:
Preference
,
_workspace
:
Workspace
)
=
{
val
(
modelName
,
volumesValue
)
=
volumes
(
workspace
,
model
)
...
...
@@ -59,7 +60,7 @@ object GAMATask {
case
_
=>
None
}
ContainerTask
.
prepare
(
installContainerSystem
,
gamaImage
(
version
),
installCommands
,
volumesValue
.
map
{
case
(
lv
,
cv
)
⇒
lv
.
getAbsolutePath
->
cv
},
error
)
ContainerTask
.
prepare
(
installContainerSystem
,
gamaImage
(
version
),
installCommands
,
volumesValue
.
map
{
case
(
lv
,
cv
)
⇒
lv
.
getAbsolutePath
->
cv
},
error
,
clearCache
=
clearCache
)
}
def
apply
(
...
...
@@ -78,6 +79,7 @@ object GAMATask {
environmentVariables
:
Seq
[
EnvironmentVariable
]
=
Vector
.
empty
,
hostFiles
:
Seq
[
HostFile
]
=
Vector
.
empty
,
workDirectory
:
OptionalArgument
[
String
]
=
None
,
clearContainerCache
:
Boolean
=
false
,
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
)
:
GAMATask
=
{
...
...
@@ -88,7 +90,7 @@ object GAMATask {
case
_
⇒
}
val
preparedImage
=
prepare
(
workspace
,
model
,
experiment
,
install
,
installContainerSystem
,
version
)
val
preparedImage
=
prepare
(
workspace
,
model
,
experiment
,
install
,
installContainerSystem
,
version
,
clearCache
=
clearContainerCache
)
GAMATask
(
workspace
=
workspace
,
...
...
openmole/project/Libraries.scala
View file @
b5769181
...
...
@@ -8,7 +8,7 @@ object Libraries {
lazy
val
gridscaleVersion
=
"2.28"
lazy
val
sshjVersion
=
"0.27.0"
lazy
val
containerVersion
=
"1.1
0
"
lazy
val
containerVersion
=
"1.1
1
"
lazy
val
mgoVersion
=
"3.43"
lazy
val
bouncyCastleVersion
=
"1.64"
lazy
val
d3Version
=
"3.5.12"
...
...
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