Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
7131e99f
Commit
7131e99f
authored
Jul 19, 2004
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added calculation of estimated termination
parent
da1107d7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
lib/python/Products/ZCatalog/ProgressHandler.py
lib/python/Products/ZCatalog/ProgressHandler.py
+10
-3
No files found.
lib/python/Products/ZCatalog/ProgressHandler.py
View file @
7131e99f
...
@@ -18,8 +18,11 @@ $Id: ZCatalog.py 25050 2004-05-27 15:06:40Z chrisw $
...
@@ -18,8 +18,11 @@ $Id: ZCatalog.py 25050 2004-05-27 15:06:40Z chrisw $
import
time
,
sys
import
time
,
sys
from
zLOG
import
LOG
,
INFO
from
zLOG
import
LOG
,
INFO
from
DateTime.DateTime
import
DateTime
from
Interface
import
Interface
from
Interface
import
Interface
class
IProgressHandler
(
Interface
):
class
IProgressHandler
(
Interface
):
""" A handler to log progress informations for long running
""" A handler to log progress informations for long running
operations.
operations.
...
@@ -72,9 +75,13 @@ class StdoutHandler:
...
@@ -72,9 +75,13 @@ class StdoutHandler:
(
time
.
time
()
-
self
.
_start
))
(
time
.
time
()
-
self
.
_start
))
def
report
(
self
,
current
,
*
args
,
**
kw
):
def
report
(
self
,
current
,
*
args
,
**
kw
):
if
current
>
0
:
seconds_so_far
=
time
.
time
()
-
self
.
_start
seconds_to_go
=
seconds_so_far
/
current
*
(
self
.
_max
-
current
)
if
current
%
self
.
_steps
==
0
:
if
current
%
self
.
_steps
==
0
:
self
.
output
(
'%d/%d (%.2f%%)'
%
(
current
,
self
.
_max
,
self
.
output
(
'%d/%d (%.2f%%) Estimated termination: %s'
%
\
(
100.0
*
current
/
self
.
_max
)))
(
current
,
self
.
_max
,
(
100.0
*
current
/
self
.
_max
),
DateTime
(
time
.
time
()
+
seconds_to_go
)))
def
output
(
self
,
text
):
def
output
(
self
,
text
):
print
>>
self
.
fp
,
'%s: %s'
%
(
self
.
_ident
,
text
)
print
>>
self
.
fp
,
'%s: %s'
%
(
self
.
_ident
,
text
)
...
...
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