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
Korben Tompkin
cse138-assignment-4-test-suite
Commits
3a037888
Commit
3a037888
authored
1 month ago
by
zphrs
Browse files
Options
Downloads
Patches
Plain Diff
Minor perf improvements
parent
4618a03b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/containers.py
+18
-5
18 additions, 5 deletions
utils/containers.py
with
18 additions
and
5 deletions
utils/containers.py
+
18
−
5
View file @
3a037888
...
@@ -107,7 +107,7 @@ class ClusterConductor:
...
@@ -107,7 +107,7 @@ class ClusterConductor:
def
dump_all_container_logs
(
self
,
dir
):
def
dump_all_container_logs
(
self
,
dir
):
self
.
log
(
"
dumping logs of kvs containers
"
)
self
.
log
(
"
dumping logs of kvs containers
"
)
container_pattern
=
"
^kvs_.*
"
container_pattern
=
f
"
^kvs_
{
self
.
group_id
}
_
.*
"
container_regex
=
re
.
compile
(
container_pattern
)
container_regex
=
re
.
compile
(
container_pattern
)
containers
=
self
.
_list_containers
()
containers
=
self
.
_list_containers
()
...
@@ -143,6 +143,17 @@ class ClusterConductor:
...
@@ -143,6 +143,17 @@ class ClusterConductor:
error_prefix
=
f
"
failed to remove container
{
name
}
"
,
error_prefix
=
f
"
failed to remove container
{
name
}
"
,
)
)
def
_remove_containers
(
self
,
names
:
list
[
str
])
->
None
:
if
len
(
names
)
==
0
:
return
self
.
log
(
f
"
removing containers
{
names
}
"
)
run_cmd_bg
(
self
.
_make_remove_cmd
(
names
[
0
])
+
names
[
1
:],
verbose
=
True
,
error_prefix
=
f
"
failed to remove containers
{
names
}
"
,
)
def
_remove_network
(
self
,
name
:
str
)
->
None
:
def
_remove_network
(
self
,
name
:
str
)
->
None
:
# remove a single network
# remove a single network
self
.
log
(
f
"
removing network
{
name
}
"
)
self
.
log
(
f
"
removing network
{
name
}
"
)
...
@@ -184,10 +195,12 @@ class ClusterConductor:
...
@@ -184,10 +195,12 @@ class ClusterConductor:
# cleanup containers
# cleanup containers
self
.
log
(
f
"
cleaning up
{
'
group
'
if
group_only
else
'
all
'
}
containers
"
)
self
.
log
(
f
"
cleaning up
{
'
group
'
if
group_only
else
'
all
'
}
containers
"
)
containers
=
self
.
_list_containers
()
containers
=
self
.
_list_containers
()
for
container
in
containers
:
containers_to_remove
=
[
if
container
and
container_regex
.
match
(
container
):
container
self
.
_remove_container
(
container
)
for
container
in
containers
if
container
and
container_regex
.
match
(
container
)
]
self
.
_remove_containers
(
containers_to_remove
)
# cleanup networks
# cleanup networks
self
.
log
(
f
"
cleaning up
{
'
group
'
if
group_only
else
'
all
'
}
networks
"
)
self
.
log
(
f
"
cleaning up
{
'
group
'
if
group_only
else
'
all
'
}
networks
"
)
networks
=
self
.
_list_networks
()
networks
=
self
.
_list_networks
()
...
...
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