Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DALSim-Docker
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thibaut DEMARE
DALSim-Docker
Commits
b78bd80e
Commit
b78bd80e
authored
5 years ago
by
ThibautDemare
Browse files
Options
Downloads
Patches
Plain Diff
timedelta should be imported independently
parent
60bd6598
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
startSimus.py
+3
-2
3 additions, 2 deletions
startSimus.py
with
3 additions
and
2 deletions
startSimus.py
+
3
−
2
View file @
b78bd80e
...
...
@@ -2,6 +2,7 @@ from subprocess import run, Popen, PIPE
import
multiprocessing
import
time
from
datetime
import
datetime
from
datetime
import
timedelta
def
nbContainers
():
result
=
run
(
"
docker ps -aq | wc -l
"
,
shell
=
True
,
stdout
=
PIPE
).
stdout
.
decode
(
'
utf-8
'
)
...
...
@@ -14,8 +15,8 @@ def backup():
Popen
(
"
docker checkpoint create --leave-running=true --checkpoint-dir=
'
$(pwd)/
"
+
str
(
c
)
"
/ContainerBackup/
'
"
+
c
+
"
"
+
"
checkpoint_
"
+
c
)
def
checkForBackupNeedsAndWait
():
# Should we backup the simulations ?
timeBetweenTwoBackup
=
datetime
.
timedelta
(
minutes
=
10
)
# We have one day between two backups
# Should we backup the simulations ?
timeBetweenTwoBackup
=
timedelta
(
minutes
=
2
)
# We have one day between two backups
now
=
datetime
.
now
()
if
now
>
(
lastBackup
+
timeBetweenTwoBackup
):
backup
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment