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
Daksh Kalpesh Shah
cse138-assignment-4-test-suite
Commits
916a01e0
Commit
916a01e0
authored
1 month ago
by
zphrs
Browse files
Options
Downloads
Patches
Plain Diff
fixed issue with not sending metadata with None timeout
parent
d7a0e6a1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/containers.py
+4
-4
4 additions, 4 deletions
utils/containers.py
utils/kvs_api.py
+16
-9
16 additions, 9 deletions
utils/kvs_api.py
with
20 additions
and
13 deletions
utils/containers.py
+
4
−
4
View file @
916a01e0
...
...
@@ -439,8 +439,8 @@ class ClusterConductor:
node
.
index
].
base_url
=
self
.
node_external_endpoint
(
node
.
index
)
view_changed
=
True
#
if view_changed and hasattr(self, "_parent"):
#
self._parent.rebroadcast_view(self.get_shard_view())
if
view_changed
and
hasattr
(
self
,
"
_parent
"
):
self
.
_parent
.
rebroadcast_view
(
self
.
get_shard_view
())
def
create_partition
(
self
,
node_ids
:
List
[
int
],
partition_id
:
str
)
->
None
:
net_name
=
f
"
kvs_
{
self
.
group_id
}
_net_
{
partition_id
}
"
...
...
@@ -505,8 +505,8 @@ class ClusterConductor:
node
.
index
].
base_url
=
self
.
node_external_endpoint
(
node
.
index
)
view_changed
=
True
#
if view_changed and hasattr(self, "_parent"):
#
self._parent.rebroadcast_view(self.get_shard_view())
if
view_changed
and
hasattr
(
self
,
"
_parent
"
):
self
.
_parent
.
rebroadcast_view
(
self
.
get_shard_view
())
DeprecationWarning
(
"
View is in updated format
"
)
...
...
This diff is collapsed.
Click to expand it.
utils/kvs_api.py
+
16
−
9
View file @
916a01e0
...
...
@@ -110,7 +110,7 @@ class KVSClient:
r
.
status_code
=
REQUEST_TIMEOUT_STATUS_CODE
return
r
else
:
return
requests
.
get
(
f
"
{
self
.
base_url
}
/data
"
)
return
requests
.
get
(
f
"
{
self
.
base_url
}
/data
"
,
json
=
create_json
(
metadata
)
)
def
clear
(
self
,
timeout
:
float
=
DEFAULT_TIMEOUT
)
->
None
:
response
=
self
.
get_all
(
timeout
=
timeout
)
...
...
@@ -134,21 +134,29 @@ class KVSClient:
request_body
=
{
"
view
"
:
view
}
return
requests
.
put
(
f
"
{
self
.
base_url
}
/view
"
,
json
=
request_body
,
timeout
=
timeout
)
async
def
async_send_view
(
self
,
view
:
dict
[
str
,
List
[
Dict
[
str
,
Any
]]],
timeout
:
float
=
DEFAULT_TIMEOUT
)
->
aiohttp
.
ClientResponse
:
async
def
async_send_view
(
self
,
view
:
dict
[
str
,
List
[
Dict
[
str
,
Any
]]],
timeout
:
float
=
DEFAULT_TIMEOUT
)
->
aiohttp
.
ClientResponse
:
if
not
isinstance
(
view
,
dict
):
raise
ValueError
(
"
view must be a dict
"
)
self
.
last_view
=
view
request_body
=
{
"
view
"
:
view
}
async
with
aiohttp
.
ClientSession
()
as
session
:
async
with
session
.
put
(
f
"
{
self
.
base_url
}
/view
"
,
json
=
request_body
,
timeout
=
timeout
)
as
response
:
async
with
session
.
put
(
f
"
{
self
.
base_url
}
/view
"
,
json
=
request_body
,
timeout
=
timeout
)
as
response
:
return
response
if
response
.
status
!=
200
:
raise
RuntimeError
(
f
"
failed to send view:
{
response
.
status
}
"
)
return
response
def
resend_last_view_with_ips_from_new_view
(
self
,
current_view
:
dict
[
str
,
List
[
Dict
[
str
,
Any
]]],
timeout
:
float
=
DEFAULT_TIMEOUT
)
->
requests
.
Response
:
def
resend_last_view_with_ips_from_new_view
(
self
,
current_view
:
dict
[
str
,
List
[
Dict
[
str
,
Any
]]],
timeout
:
float
=
DEFAULT_TIMEOUT
,
)
->
requests
.
Response
:
if
not
isinstance
(
current_view
,
dict
):
raise
ValueError
(
"
view must be a dict
"
)
if
not
hasattr
(
self
,
"
last_view
"
):
...
...
@@ -158,12 +166,11 @@ class KVSClient:
for
shard_key
in
current_view
:
for
node
in
current_view
[
shard_key
]:
flattened_current_view
[
node
[
"
id
"
]]
=
node
[
"
address
"
]
for
shard_key
in
self
.
last_view
:
for
node
in
self
.
last_view
[
shard_key
]:
node
[
'
address
'
]
=
flattened_current_view
[
node
[
"
id
"
]]
node
[
"
address
"
]
=
flattened_current_view
[
node
[
"
id
"
]]
request_body
=
{
"
view
"
:
self
.
last_view
}
print
(
f
"
Sending new view:
{
self
.
last_view
}
"
)
return
requests
.
put
(
f
"
{
self
.
base_url
}
/view
"
,
json
=
request_body
,
timeout
=
timeout
)
\ No newline at end of file
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