Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
b86bc2ce
Commit
b86bc2ce
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fasten wot graph generation with asyncio.gather
parent
cf9514bb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/core/graph/explorer_graph.py
+8
-4
8 additions, 4 deletions
src/sakia/core/graph/explorer_graph.py
src/sakia/core/graph/wot_graph.py
+12
-6
12 additions, 6 deletions
src/sakia/core/graph/wot_graph.py
with
20 additions
and
10 deletions
src/sakia/core/graph/explorer_graph.py
+
8
−
4
View file @
b86bc2ce
...
@@ -85,12 +85,16 @@ class ExplorerGraph(BaseGraph):
...
@@ -85,12 +85,16 @@ class ExplorerGraph(BaseGraph):
certifier_list
,
certified_list
=
await
asyncio
.
gather
(
certifier_coro
,
certified_coro
)
certifier_list
,
certified_list
=
await
asyncio
.
gather
(
certifier_coro
,
certified_coro
)
await
self
.
add_certifier_list
(
certifier_list
,
current_identity
,
identity
)
certifier_coro
=
asyncio
.
ensure_future
(
self
.
add_certifier_list
(
certifier_list
,
current_identity
,
identity
))
logging
.
debug
(
"
New identity certifiers : {pubkey}
"
.
format
(
pubkey
=
current_identity
.
pubkey
[:
5
]))
logging
.
debug
(
"
New identity certifiers : {pubkey}
"
.
format
(
pubkey
=
current_identity
.
pubkey
[:
5
]))
self
.
graph_changed
.
emit
()
certified_coro
=
asyncio
.
ensure_future
(
self
.
add_certified_list
(
certified_list
,
await
self
.
add_certified_list
(
certified_list
,
current_identity
,
identity
)
current_identity
,
identity
))
certifier_coro
.
add_done_callback
(
lambda
f
:
self
.
graph_changed
.
emit
())
certified_coro
.
add_done_callback
(
lambda
f
:
self
.
graph_changed
.
emit
())
await
asyncio
.
gather
(
certifier_coro
,
certified_coro
)
logging
.
debug
(
"
New identity certified : {pubkey}
"
.
format
(
pubkey
=
current_identity
.
pubkey
[:
5
]))
logging
.
debug
(
"
New identity certified : {pubkey}
"
.
format
(
pubkey
=
current_identity
.
pubkey
[:
5
]))
self
.
graph_changed
.
emit
()
for
cert
in
certified_list
+
certifier_list
:
for
cert
in
certified_list
+
certifier_list
:
if
cert
[
'
identity
'
]
not
in
explorable
[
step
+
1
]:
if
cert
[
'
identity
'
]
not
in
explorable
[
step
+
1
]:
...
...
This diff is collapsed.
Click to expand it.
src/sakia/core/graph/wot_graph.py
+
12
−
6
View file @
b86bc2ce
...
@@ -22,15 +22,21 @@ class WoTGraph(BaseGraph):
...
@@ -22,15 +22,21 @@ class WoTGraph(BaseGraph):
self
.
add_identity
(
center_identity
,
node_status
)
self
.
add_identity
(
center_identity
,
node_status
)
# create Identity from node metadata
# create Identity from node metadata
certifier_list
=
await
center_identity
.
unique_valid_certifiers_of
(
self
.
app
.
identities_registry
,
certifier_coro
=
asyncio
.
ensure_future
(
center_identity
.
unique_valid_certifiers_of
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
))
certified_list
=
await
center_identity
.
unique_valid_certified_by
(
self
.
app
.
identities_registry
,
certified_coro
=
asyncio
.
ensure_future
(
center_identity
.
unique_valid_certified_by
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
))
certifier_list
,
certified_list
=
await
asyncio
.
gather
(
certifier_coro
,
certified_coro
)
# populate graph with certifiers-of
# populate graph with certifiers-of
await
self
.
add_certifier_list
(
certifier_list
,
center_identity
,
account_identity
)
certifier_coro
=
asyncio
.
ensure_future
(
self
.
add_certifier_list
(
certifier_list
,
center_identity
,
account_identity
))
# populate graph with certified-by
# populate graph with certified-by
await
self
.
add_certified_list
(
certified_list
,
center_identity
,
account_identity
)
certified_coro
=
asyncio
.
ensure_future
(
self
.
add_certified_list
(
certified_list
,
center_identity
,
account_identity
))
await
asyncio
.
gather
(
certifier_coro
,
certified_coro
)
async
def
get_shortest_path_to_identity
(
self
,
account_identity
,
to_identity
):
async
def
get_shortest_path_to_identity
(
self
,
account_identity
,
to_identity
):
"""
"""
...
...
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