Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cse138-assignment-4-test-suite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Evan Kelly Jones
cse138-assignment-4-test-suite
Compare revisions
main to view-fixes
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
evkjones/cse138-assignment-4-test-suite
Select target project
No results found
view-fixes
Select Git revision
Branches
main
port_asgn3
view-fixes
Swap
Target
awaghili/cse138-assignment-4-test-suite
Select target project
dakshah/cse138-assignment-4-test-suite
ketompki/cse138-assignment-4-test-suite
evkjones/cse138-assignment-4-test-suite
ranadkar/cse138-assignment-4-test-suite
ctknab/cse138-assignment-4-test-suite
awaghili/cse138-assignment-4-test-suite
6 results
main
Select Git revision
Branches
main
zphrs-log-fix
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
Fix view broadcast errors
· b1f5f9bd
Evan Jones (原文轩)
authored
1 month ago
b1f5f9bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/containers.py
+12
-14
12 additions, 14 deletions
utils/containers.py
with
12 additions
and
14 deletions
utils/containers.py
View file @
b1f5f9bd
from
typing
import
List
from
typing
import
Any
,
List
from
dataclasses
import
dataclass
import
os
import
json
...
...
@@ -50,6 +50,9 @@ class ClusterNode:
def
external_endpoint
(
self
)
->
str
:
return
f
"
http://localhost:
{
self
.
external_port
}
"
def
node_info
(
self
)
->
dict
:
return
{
"
address
"
:
f
"
{
self
.
ip
}
:
{
self
.
port
}
"
,
"
id
"
:
self
.
index
}
class
ClusterConductor
:
# _parent: KVSTestFixture
...
...
@@ -115,8 +118,7 @@ class ClusterConductor:
for
container
in
containers
:
if
container
and
container_regex
.
match
(
container
):
self
.
_dump_container_logs
(
dir
,
container
)
def
get_view
(
self
)
->
str
:
return
{
"
address
"
:
f
"
{
self
.
ip
}
:
{
self
.
port
}
"
,
"
id
"
:
self
.
index
}
def
_dump_container_logs
(
self
,
dir
,
name
:
str
)
->
None
:
log_file
=
os
.
path
.
join
(
dir
,
f
"
{
name
}
.log
"
)
self
.
log
(
f
"
Dumping logs for container
{
name
}
to file
{
log_file
}
"
)
...
...
@@ -507,10 +509,7 @@ class ClusterConductor:
def
get_node
(
self
,
index
):
return
self
.
nodes
[
index
]
def
get_full_view
(
self
):
view
=
[]
for
node
in
self
.
nodes
:
view
.
append
({
"
address
"
:
f
"
{
node
.
ip
}
:
{
node
.
port
}
"
,
"
id
"
:
node
.
index
})
return
view
return
self
.
get_shard_view
()
def
get_node
(
self
,
index
):
return
self
.
nodes
[
index
]
...
...
@@ -553,19 +552,18 @@ class ClusterConductor:
return
self
.
shards
[
shard_name
].
remove
(
node
)
def
get_shard_view
(
self
)
->
dict
:
def
get_shard_view
(
self
)
->
dict
[
str
,
list
[
dict
[
str
,
Any
]]]
:
return
{
shard
:
[
node
.
get_view
()
for
node
in
nodes
]
shard
:
[
node
.
node_info
()
for
node
in
nodes
]
for
shard
,
nodes
in
self
.
shards
.
items
()
}
def
get_partition_view
(
self
,
partition_id
:
str
):
net_name
=
f
"
kvs_
{
self
.
group_id
}
_net_
{
partition_id
}
"
view
=
[]
for
node
in
self
.
nodes
:
if
net_name
in
node
.
networks
:
view
.
append
({
"
address
"
:
f
"
{
node
.
ip
}
:
{
node
.
port
}
"
,
"
id
"
:
node
.
index
})
return
view
return
{
shard
:
[
node
.
node_info
()
for
node
in
nodes
if
net_name
in
node
.
networks
]
for
shard
,
nodes
in
self
.
shards
.
items
()
}
def
__enter__
(
self
):
return
self
...
...
This diff is collapsed.
Click to expand it.