Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildgrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
Show more breadcrumbs
BuildGrid
buildgrid
Commits
97a5ee90
Commit
97a5ee90
authored
6 years ago
by
Martin Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
bots/service.py: Calculate bot counts
parent
53615a07
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
buildgrid/server/bots/service.py
+9
-4
9 additions, 4 deletions
buildgrid/server/bots/service.py
buildgrid/server/execution/service.py
+15
-15
15 additions, 15 deletions
buildgrid/server/execution/service.py
with
24 additions
and
19 deletions
buildgrid/server/bots/service.py
+
9
−
4
View file @
97a5ee90
...
...
@@ -36,16 +36,21 @@ class BotsService(bots_pb2_grpc.BotsServicer):
def
__init__
(
self
,
server
,
monitor
=
True
):
self
.
__logger
=
logging
.
getLogger
(
__name__
)
self
.
__bots_by_status
=
{}
self
.
__bots_by_instance
=
{}
self
.
__bots
=
{}
self
.
__bots_by_status
=
None
self
.
__bots_by_instance
=
None
self
.
__bots
=
None
self
.
_instances
=
{}
self
.
_is_monitored
=
True
bots_pb2_grpc
.
add_BotsServicer_to_server
(
self
,
server
)
self
.
_is_monitored
=
monitor
if
self
.
_is_monitored
:
self
.
__bots_by_status
=
{}
self
.
__bots_by_instance
=
{}
self
.
__bots
=
{}
self
.
__bots_by_status
[
BotStatus
.
OK
]
=
set
()
self
.
__bots_by_status
[
BotStatus
.
UNHEALTHY
]
=
set
()
self
.
__bots_by_status
[
BotStatus
.
HOST_REBOOTING
]
=
set
()
...
...
This diff is collapsed.
Click to expand it.
buildgrid/server/execution/service.py
+
15
−
15
View file @
97a5ee90
...
...
@@ -157,6 +157,21 @@ class ExecutionService(remote_execution_pb2_grpc.ExecutionServicer):
context
.
set_code
(
grpc
.
StatusCode
.
INVALID_ARGUMENT
)
yield
operations_pb2
.
Operation
()
# --- Public API: Monitoring ---
@property
def
is_monitored
(
self
):
return
self
.
_is_monitored
def
query_n_clients
(
self
):
return
len
(
self
.
__peers
)
def
query_n_clients_for_instance
(
self
,
instance_name
):
try
:
return
len
(
self
.
__peers_by_instance
[
instance_name
])
except
KeyError
:
return
0
# --- Private API ---
def
_rpc_termination_callback
(
self
,
peer
,
instance_name
,
job_name
,
message_queue
):
...
...
@@ -177,18 +192,3 @@ class ExecutionService(remote_execution_pb2_grpc.ExecutionServicer):
except
KeyError
:
raise
InvalidArgumentError
(
"
Instance doesn
'
t exist on server: [{}]
"
.
format
(
name
))
# --- Public API: Monitoring ---
@property
def
is_monitored
(
self
):
return
self
.
_is_monitored
def
query_n_clients
(
self
):
return
len
(
self
.
__peers
)
def
query_n_clients_for_instance
(
self
,
instance_name
):
try
:
return
len
(
self
.
__peers_by_instance
[
instance_name
])
except
KeyError
:
return
0
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