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
e143fc8a
Commit
e143fc8a
authored
6 years ago
by
Martin Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
scheduler.py: Move out ListOperationsResponse creation
#117
parent
c720eeb9
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
buildgrid/server/operations/instance.py
+5
-1
5 additions, 1 deletion
buildgrid/server/operations/instance.py
buildgrid/server/scheduler.py
+2
-6
2 additions, 6 deletions
buildgrid/server/scheduler.py
with
7 additions
and
7 deletions
buildgrid/server/operations/instance.py
+
5
−
1
View file @
e143fc8a
...
...
@@ -22,6 +22,7 @@ An instance of the LongRunningOperations Service.
import
logging
from
buildgrid._exceptions
import
InvalidArgumentError
from
buildgrid._protos.google.longrunning
import
operations_pb2
class
OperationsInstance
:
...
...
@@ -45,7 +46,10 @@ class OperationsInstance:
def
list_operations
(
self
,
list_filter
,
page_size
,
page_token
):
# TODO: Pages
# Spec says number of pages and length of a page are optional
return
self
.
_scheduler
.
get_operations
()
response
=
operations_pb2
.
ListOperationsResponse
()
response
.
operations
.
extend
([
job
.
operation
for
job
in
self
.
_scheduler
.
list_jobs
()])
return
response
def
delete_operation
(
self
,
name
):
try
:
...
...
This diff is collapsed.
Click to expand it.
buildgrid/server/scheduler.py
+
2
−
6
View file @
e143fc8a
...
...
@@ -24,7 +24,6 @@ Schedules jobs.
from
collections
import
deque
from
buildgrid._exceptions
import
NotFoundError
from
buildgrid._protos.google.longrunning
import
operations_pb2
from
.job
import
OperationStage
,
LeaseState
...
...
@@ -75,11 +74,8 @@ class Scheduler:
job
.
update_operation_stage
(
OperationStage
.
QUEUED
)
self
.
queue
.
appendleft
(
job
)
def
get_operations
(
self
):
response
=
operations_pb2
.
ListOperationsResponse
()
for
v
in
self
.
jobs
.
values
():
response
.
operations
.
extend
([
v
.
operation
])
return
response
def
list_jobs
(
self
):
return
self
.
jobs
.
values
()
def
update_job_lease_state
(
self
,
job_name
,
lease_state
,
lease_status
=
None
,
lease_result
=
None
):
job
=
self
.
jobs
[
job_name
]
...
...
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