Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
6ba39b09
Commit
6ba39b09
authored
Mar 09, 2025
by
GuanLuo
Committed by
GitHub
Mar 09, 2025
Browse files
chore: address comments for #35 (#53)
parent
19844fc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
lib/bindings/python/tests/test_kv_bindings.py
lib/bindings/python/tests/test_kv_bindings.py
+12
-18
No files found.
lib/bindings/python/tests/test_kv_bindings.py
View file @
6ba39b09
...
...
@@ -29,8 +29,6 @@ from dynamo.runtime import DistributedRuntime
pytestmark
=
pytest
.
mark
.
pre_merge
runtime
=
None
@
pytest
.
fixture
(
scope
=
"module"
,
autouse
=
True
)
def
setup_and_teardown
():
...
...
@@ -50,12 +48,13 @@ def setup_and_teardown():
etcd
.
wait
()
async
def
test_event_handler
():
global
runtime
if
runtime
is
None
:
loop
=
asyncio
.
get_running_
loop
(
)
runtime
=
DistributedRuntime
(
loop
)
@
pytest
.
fixture
(
scope
=
"module"
)
async
def
distributed_
runtime
():
loop
=
asyncio
.
get_running_loop
()
return
DistributedRuntime
(
loop
)
async
def
test_event_handler
(
distributed_runtime
):
namespace
=
"kv_test"
component
=
"event"
...
...
@@ -64,7 +63,7 @@ async def test_event_handler():
event_publisher
=
EventPublisher
(
namespace
,
component
,
worker_id
)
# indexer
kv_listener
=
runtime
.
namespace
(
namespace
).
component
(
component
)
kv_listener
=
distributed_
runtime
.
namespace
(
namespace
).
component
(
component
)
await
kv_listener
.
create_service
()
indexer
=
KvIndexer
(
kv_listener
)
...
...
@@ -160,15 +159,10 @@ class EventPublisher:
assert
result
==
DynamoResult
.
OK
async
def
test_metrics_aggregator
():
global
runtime
if
runtime
is
None
:
loop
=
asyncio
.
get_running_loop
()
runtime
=
DistributedRuntime
(
loop
)
async
def
test_metrics_aggregator
(
distributed_runtime
):
namespace
=
"kv_test"
component
=
"metrics"
kv_listener
=
runtime
.
namespace
(
namespace
).
component
(
component
)
kv_listener
=
distributed_
runtime
.
namespace
(
namespace
).
component
(
component
)
await
kv_listener
.
create_service
()
# aggregator
...
...
@@ -185,8 +179,8 @@ async def test_metrics_aggregator():
"kv_total_blocks"
:
777
,
}
# need 'create_task
k
' to put publisher task in the background
asyncio
.
create_task
(
metrics_publisher
(
kv_listener
,
expected_metrics
))
# need 'create_task' to put publisher task in the background
asyncio
.
create_task
(
metrics_publisher
_task
(
kv_listener
,
expected_metrics
))
# needs time for publisher to spawn up
for
i
in
range
(
10
):
...
...
@@ -205,7 +199,7 @@ async def test_metrics_aggregator():
assert
endpoint
.
kv_total_blocks
==
expected_metrics
[
"kv_total_blocks"
]
async
def
metrics_publisher
(
kv_listener
,
expected_metrics
):
async
def
metrics_publisher
_task
(
kv_listener
,
expected_metrics
):
metrics_publisher
=
KvMetricsPublisher
()
metrics_publisher
.
publish
(
expected_metrics
[
"request_active_slots"
],
...
...
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