Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
c6ea3739
Commit
c6ea3739
authored
Sep 06, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
58c2e39a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
11 deletions
+33
-11
go/neo/server/storage.go
go/neo/server/storage.go
+11
-1
go/neo/t/t.sh
go/neo/t/t.sh
+2
-2
go/neo/t/zsha1.go
go/neo/t/zsha1.go
+3
-2
go/neo/t/zsha1.py
go/neo/t/zsha1.py
+4
-2
go/xcommon/log/log.go
go/xcommon/log/log.go
+12
-3
go/xcommon/task/task.go
go/xcommon/task/task.go
+1
-1
No files found.
go/neo/server/storage.go
View file @
c6ea3739
...
...
@@ -27,6 +27,8 @@ import (
"sync"
"time"
"github.com/pkg/errors"
"lab.nexedi.com/kirr/neo/go/neo"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/xcommon/log"
...
...
@@ -454,7 +456,15 @@ func (stor *Storage) serveClient(ctx context.Context, req neo.Request) {
// TODO += timeout -> go away if inactive
req
,
err
=
link
.
Recv1
()
if
err
!=
nil
{
log
.
Error
(
ctx
,
err
)
switch
errors
.
Cause
(
err
)
{
// XXX closed by main or peer down - all logged by main called
// XXX review
case
neo
.
ErrLinkDown
,
neo
.
ErrLinkClosed
:
// ok
default
:
log
.
Error
(
ctx
,
err
)
}
return
}
}
...
...
go/neo/t/t.sh
View file @
c6ea3739
...
...
@@ -223,8 +223,8 @@ N=`seq 2` # XXX repeat benchmarks N time
# time1 <url> - run benchmarks on the URL once
bench1
()
{
url
=
$1
time
demo-zbigarray
read
$url
./zsha1.py
$url
#
time demo-zbigarray read $url
#
./zsha1.py $url
if
[[
$url
==
zeo://
*
]]
;
then
echo
"(skipping zsha1.go on ZEO -- Cgo does not support zeo:// protocol)"
return
...
...
go/neo/t/zsha1.go
View file @
c6ea3739
...
...
@@ -66,7 +66,8 @@ loop:
}
tend
:=
time
.
Now
()
δt
:=
tend
.
Sub
(
tstart
)
fmt
.
Printf
(
"%x ; oid=0..%d nread=%d t=%s x=zsha1.go
\n
"
,
m
.
Sum
(
nil
),
oid
-
1
,
nread
,
tend
.
Sub
(
tstart
))
fmt
.
Printf
(
"%x ; oid=0..%d nread=%d t=%s
(%s / object)
x=zsha1.go
\n
"
,
m
.
Sum
(
nil
),
oid
-
1
,
nread
,
δt
,
δt
/
time
.
Duration
(
oid
))
// XXX /oid cast ?
}
go/neo/t/zsha1.py
View file @
c6ea3739
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""zsha1 - compute sha1 of whole latest objects stream in a ZODB database"""
from
__future__
import
print_function
...
...
@@ -38,9 +39,10 @@ def main():
oid
+=
1
tend
=
time
()
dt
=
tend
-
tstart
print
(
'%s ; oid=0..%d nread=%d t=%.3fs x=zsha1.py'
%
\
(
m
.
hexdigest
(),
oid
-
1
,
nread
,
tend
-
tstart
))
print
(
'%s ; oid=0..%d nread=%d t=%.3fs
(%.1fμs / object)
x=zsha1.py'
%
\
(
m
.
hexdigest
(),
oid
-
1
,
nread
,
dt
,
dt
*
1E6
/
oid
))
if
__name__
==
'__main__'
:
...
...
go/xcommon/log/log.go
View file @
c6ea3739
...
...
@@ -67,6 +67,13 @@ func (d Depth) Infof(ctx context.Context, format string, argv ...interface{}) {
glog
.
InfoDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
}
func
(
d
Depth
)
Warning
(
ctx
context
.
Context
,
argv
...
interface
{})
{
glog
.
WarningDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
argv
...
)
...
)
}
func
(
d
Depth
)
Warningf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
glog
.
WarningDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
fmt
.
Sprintf
(
format
,
argv
...
))
...
)
}
func
(
d
Depth
)
Error
(
ctx
context
.
Context
,
argv
...
interface
{})
{
glog
.
ErrorDepth
(
int
(
d
+
1
),
withTask
(
ctx
,
argv
...
)
...
)
}
...
...
@@ -78,15 +85,17 @@ func (d Depth) Errorf(ctx context.Context, format string, argv ...interface{}) {
func
Info
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Info
(
ctx
,
argv
...
)
}
func
Warning
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Warning
(
ctx
,
argv
...
)
}
func
Error
(
ctx
context
.
Context
,
argv
...
interface
{})
{
Depth
(
1
)
.
Error
(
ctx
,
argv
...
)
}
func
Infof
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Infof
(
ctx
,
format
,
argv
...
)
}
func
Warningf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Warningf
(
ctx
,
format
,
argv
...
)
}
func
Errorf
(
ctx
context
.
Context
,
format
string
,
argv
...
interface
{})
{
Depth
(
1
)
.
Errorf
(
ctx
,
format
,
argv
...
)
}
// TODO Warningf, ...
go/xcommon/task/task.go
View file @
c6ea3739
...
...
@@ -53,7 +53,7 @@ func running(ctxp *context.Context, name string) func(*error) {
// XXX is it good idea to log to error here? (not in above layer)
// XXX what is error here could be not so error above
// XXX or we still want to log all errors - right?
log
.
Depth
(
1
)
.
Error
(
ctx
,
"## "
,
*
errp
)
// XXX "::" temp
log
.
Depth
(
1
)
.
Warning
(
ctx
,
"## "
,
*
errp
)
// XXX "::" temp
}
else
{
log
.
Depth
(
1
)
.
Info
(
ctx
,
"done"
)
}
...
...
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