Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
79ed456f
Commit
79ed456f
authored
4 years ago
by
Lorenz Boguhn
Browse files
Options
Downloads
Patches
Plain Diff
Fix WorkloadGEneratorStateCleaner
parent
ea12bae6
No related branches found
No related tags found
4 merge requests
!159
Re-implementation of Theodolite with Kotlin/Quarkus
,
!157
Update Graal Image in CI pipeline
,
!83
WIP: Re-implementation of Theodolite with Kotlin/Quarkus
,
!78
Resolve "Implement Quarkus/Kotlin protype"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt
+24
-21
24 additions, 21 deletions
...in/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt
with
24 additions
and
21 deletions
theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt
+
24
−
21
View file @
79ed456f
...
...
@@ -10,7 +10,7 @@ import java.time.Duration
private
val
logger
=
KotlinLogging
.
logger
{}
/**
* Resets the workloadgenerator states in zookeper (and potetially watches for Zookeper events)
* Resets the workloadgenerator states in zookeper (and pote
n
tially watches for Zookeper events)
*
* @param ip of zookeeper
* @param path path of the zookeeper node
...
...
@@ -30,33 +30,36 @@ class WorkloadGeneratorStateCleaner(ip: String, val path: String) {
}
/**
* Deletes a
ll
Zookeeper node
s
with the corresponding path.
* Deletes a Zookeeper node
and its children
with the corresponding path.
*/
fun
deleteAll
()
{
var
deleted
=
false
while
(!
deleted
)
{
while
(
true
)
{
var
children
=
emptyList
<
String
>();
try
{
zookeeperClient
.
delete
(
this
.
path
,
-
1
)
}
catch
(
ex
:
Exception
)
{
logger
.
error
{
ex
.
toString
()
}
children
=
zookeeperClient
.
getChildren
(
this
.
path
,
true
)
}
catch
(
e
:
KeeperException
.
NoNodeException
)
{
break
;
}
// delete all children nodes
for
(
s
:
String
in
children
)
{
try
{
zookeeperClient
.
delete
(
s
,
-
1
)
}
catch
(
ex
:
Exception
)
{
logger
.
info
{
"$ex"
}
}
}
// delete main node
try
{
// get list of all nodes of the given path
val
clients
=
zookeeperClient
.
getChildren
(
this
.
path
,
true
)
if
(
clients
.
isEmpty
())
{
deleted
=
true
break
}
zookeeperClient
.
delete
(
this
.
path
,
-
1
)
break
;
}
catch
(
ex
:
Exception
)
{
when
(
ex
)
{
// indicates that there are no nodes to delete left
is
KeeperException
->
{
deleted
=
true
}
is
InterruptedException
->
{
logger
.
error
{
ex
.
toString
()
}
}
// no instance of node found
if
(
ex
is
KeeperException
.
NoNodeException
)
{
break
;
}
else
{
logger
.
error
{
ex
.
toString
()
}
}
}
Thread
.
sleep
(
retryAfter
.
toMillis
())
...
...
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