Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Gabriel Monnerat
slapos.toolbox
Commits
b8f0ce15
Commit
b8f0ce15
authored
Apr 04, 2012
by
Łukasz Nowak
Committed by
Alain Takoudjou
Jun 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tool to pack ZODB.
parent
4bc01c2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
slapos/zodbpack.py
slapos/zodbpack.py
+40
-0
No files found.
slapos/zodbpack.py
0 → 100644
View file @
b8f0ce15
import
ZODB.FileStorage
import
ZODB.serialize
import
argparse
import
time
import
traceback
def
run
():
now
=
time
.
time
()
parser
=
argparse
.
ArgumentParser
(
description
=
'ZODB offline packer'
)
parser
.
add_argument
(
'files'
,
metavar
=
'F'
,
type
=
str
,
help
=
'Files to pack'
,
nargs
=
'+'
)
parser
.
add_argument
(
'--days'
,
'-d'
,
type
=
float
,
help
=
'Amount of days, from now, to pack'
)
args
=
parser
.
parse_args
()
point
=
now
-
(
3600
*
24
*
args
.
days
)
print
'Now is %s'
%
time
.
asctime
(
time
.
localtime
(
now
))
print
'Will pack until %s'
%
time
.
asctime
(
time
.
localtime
(
point
))
failures
=
0
for
f
in
args
.
files
:
b
=
time
.
time
()
print
'Trying to pack %r'
%
f
try
:
pack
(
point
,
f
)
except
Exception
:
print
'Failed to pack %r:'
%
f
traceback
.
print_exc
()
failures
+=
1
print
'Finished %s in %.3fs'
%
(
f
,
time
.
time
()
-
b
)
if
failures
:
print
'Failed files: %s'
%
failures
return
failures
else
:
print
'All files sucessfully packed.'
return
0
def
pack
(
point
,
f
):
ZODB
.
FileStorage
.
FileStorage
(
f
).
pack
(
point
,
ZODB
.
serialize
.
referencesf
)
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