Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
ae9a8f4a
Commit
ae9a8f4a
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Sub tag registration.
parent
818ffdc9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ccnode/node.py
+0
-4
0 additions, 4 deletions
ccnode/node.py
ccnode/tags.py
+22
-10
22 additions, 10 deletions
ccnode/tags.py
with
22 additions
and
14 deletions
ccnode/node.py
+
0
−
4
View file @
ae9a8f4a
...
...
@@ -53,7 +53,6 @@ class RPCStartHandler(Thread):
def
rpc_connect
(
self
):
while
True
:
try
:
logger
.
debug
(
'
About to create connection
'
)
self
.
rpc_con
=
RpcConnection
.
from_addr_ssl
(
addr
=
self
.
loop
.
config
.
server_host
,
port
=
self
.
loop
.
config
.
server_port
,
...
...
@@ -61,14 +60,12 @@ class RPCStartHandler(Thread):
loop
=
self
.
loop
.
evloop
,
on_disconnect
=
self
.
loop
.
restart_rpc_connection
,
)
logger
.
debug
(
'
Connection created
'
)
except
IOError
:
logger
.
exception
(
'
Error while connecting to the cc-server
'
)
time
.
sleep
(
5
)
else
:
break
logger
.
debug
(
'
Async send
'
)
self
.
async
.
send
()
# success
def
start
(
self
):
...
...
@@ -94,7 +91,6 @@ class RPCStartHandler(Thread):
self
.
timer
.
start
()
def
auth_cb
(
self
,
*
args
):
logger
.
debug
(
'
Callback auth
'
)
# check is fallback mode on sjrpc is set otherwise our call would block
# the loop
if
not
self
.
rpc_con
.
_event_fallback
.
is_set
():
...
...
This diff is collapsed.
Click to expand it.
ccnode/tags.py
+
22
−
10
View file @
ae9a8f4a
...
...
@@ -3,6 +3,7 @@ import logging
import
time
import
weakref
from
functools
import
partial
from
itertools
import
chain
from
collections
import
defaultdict
...
...
@@ -250,7 +251,11 @@ class TagDB(object):
for
tag
in
self
.
db
[
'
__main__
'
].
itervalues
():
self
.
rpc_register_tag
(
tag
)
# TODO register sub tags
# register sub tags on the cc-server
for
tag
in
chain
.
from_iterable
(
db
.
itervalues
()
for
name
,
db
in
self
.
db
.
iteritems
()
if
name
!=
'
__main__
'
):
self
.
rpc_register_sub_tag
(
tag
.
sub_id
,
tag
)
def
rpc_register_sub_object
(
self
,
sub_id
):
# register object on the cc-server
...
...
@@ -275,18 +280,23 @@ class TagDB(object):
self
.
rpc_call
(
tag_name
,
self
.
rpc_tag_unregister_cb
,
'
tags_unregister
'
,
tag_name
)
def
rpc_register_sub_tag
(
self
,
sub_id
,
tag
):
self
.
rpc_call
(
tag
.
name
,
self
.
rpc_sub_tag_register_cb
,
'
sub_tags_register
'
,
sub_id
,
tag
.
name
,
tag
.
ttl
,
tag
.
value
)
def
rpc_unregister_sub_tag
(
self
,
sub_id
,
tag_name
):
self
.
rpc_call
(
tag_name
,
self
.
rpc_sub_tag_unregister_cb
,
'
sub_tags_unregister
'
,
sub_id
,
tag_name
)
#: this is a method
rpc_tag_register_cb
=
rpc_simple_cb
(
'
Error while trying to register tag %s, %s(
"
%s
"
)
'
)
rpc_tag_unregister_cb
=
rpc_simple_cb
(
'
Error while trying to unregister tag %s, %s(
"
%s
"
)
'
)
def
rpc_sub_tag_register_cb
(
self
,
call_id
,
response
,
error
):
pass
def
rpc_sub_tag_unregister_cb
(
self
,
call_id
,
response
,
error
):
pass
rpc_sub_tag_register_cb
=
rpc_simple_cb
(
'
Error while registering sub tag %s, %s(
"
%s
"
)
'
)
rpc_sub_tag_unregister_cb
=
rpc_simple_cb
(
'
Error while unregistering sub tag %s, %s(
"
%s
"
)
'
)
# end RPC part
# tag handling part, used by plugins
...
...
@@ -336,7 +346,8 @@ class TagDB(object):
tag
.
db
=
self
tag
.
sub_id
=
sub_id
tag
.
start
(
self
.
main
.
evloop
)
# TODO register tag
# register tag to the cc-server
self
.
rpc_register_sub_tag
(
sub_id
,
tag
)
else
:
self
.
parent
.
add_sub_tag
(
sub_id
,
tag
)
self
.
db
[
sub_id
][
tag
.
name
]
=
tag
...
...
@@ -347,7 +358,8 @@ class TagDB(object):
tag
.
db
=
None
tag
.
sub_id
=
None
tag
.
stop
()
# TODO unregister tag
# unregister tag to the cc-server
self
.
rpc_unregister_sub_tag
(
sub_id
,
tag_name
)
else
:
self
.
parent
.
remove_sub_tag
(
sub_id
,
tag_name
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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