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
68723d8c
Commit
68723d8c
authored
6 years ago
by
Martin Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
job.py: Implement server-side ExecutedActionMetadata
#83
parent
6e9857e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.pylintrc
+2
-1
2 additions, 1 deletion
.pylintrc
buildgrid/server/job.py
+20
-0
20 additions, 0 deletions
buildgrid/server/job.py
tests/integration/operations_service.py
+2
-1
2 additions, 1 deletion
tests/integration/operations_service.py
with
24 additions
and
2 deletions
.pylintrc
+
2
−
1
View file @
68723d8c
...
...
@@ -184,7 +184,8 @@ ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=google.protobuf.any_pb2.Any
ignored-classes=google.protobuf.any_pb2.Any,
google.protobuf.timestamp_pb2.Timestamp
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
...
...
This diff is collapsed.
Click to expand it.
buildgrid/server/job.py
+
20
−
0
View file @
68723d8c
...
...
@@ -17,6 +17,8 @@ import logging
import
uuid
from
enum
import
Enum
from
google.protobuf
import
timestamp_pb2
from
buildgrid._protos.build.bazel.remote.execution.v2
import
remote_execution_pb2
from
buildgrid._protos.google.devtools.remoteworkers.v1test2
import
bots_pb2
from
buildgrid._protos.google.longrunning
import
operations_pb2
...
...
@@ -60,6 +62,9 @@ class Job:
self
.
__execute_response
=
None
self
.
__operation_metadata
=
remote_execution_pb2
.
ExecuteOperationMetadata
()
self
.
__queued_timestamp
=
timestamp_pb2
.
Timestamp
()
self
.
__worker_start_timestamp
=
timestamp_pb2
.
Timestamp
()
self
.
__worker_completed_timestamp
=
timestamp_pb2
.
Timestamp
()
self
.
__operation_metadata
.
action_digest
.
CopyFrom
(
action_digest
)
self
.
__operation_metadata
.
stage
=
OperationStage
.
UNKNOWN
.
value
...
...
@@ -177,10 +182,18 @@ class Job:
self
.
_lease
.
state
=
state
.
value
if
self
.
_lease
.
state
==
LeaseState
.
PENDING
.
value
:
self
.
__worker_start_timestamp
.
Clear
()
self
.
__worker_completed_timestamp
.
Clear
()
self
.
_lease
.
status
.
Clear
()
self
.
_lease
.
result
.
Clear
()
elif
self
.
_lease
.
state
==
LeaseState
.
ACTIVE
.
value
:
self
.
__worker_start_timestamp
.
GetCurrentTime
()
elif
self
.
_lease
.
state
==
LeaseState
.
COMPLETED
.
value
:
self
.
__worker_completed_timestamp
.
GetCurrentTime
()
action_result
=
remote_execution_pb2
.
ActionResult
()
# TODO: Make a distinction between build and bot failures!
...
...
@@ -191,6 +204,11 @@ class Job:
assert
result
.
Is
(
action_result
.
DESCRIPTOR
)
result
.
Unpack
(
action_result
)
action_metadata
=
action_result
.
execution_metadata
action_metadata
.
queued_timestamp
.
CopyFrom
(
self
.
__worker_start_timestamp
)
action_metadata
.
worker_start_timestamp
.
CopyFrom
(
self
.
__worker_start_timestamp
)
action_metadata
.
worker_completed_timestamp
.
CopyFrom
(
self
.
__worker_completed_timestamp
)
self
.
__execute_response
=
remote_execution_pb2
.
ExecuteResponse
()
self
.
__execute_response
.
result
.
CopyFrom
(
action_result
)
self
.
__execute_response
.
cached_result
=
False
...
...
@@ -208,6 +226,8 @@ class Job:
self
.
__operation_metadata
.
stage
=
stage
.
value
if
self
.
__operation_metadata
.
stage
==
OperationStage
.
QUEUED
.
value
:
if
self
.
__queued_timestamp
.
ByteSize
()
==
0
:
self
.
__queued_timestamp
.
GetCurrentTime
()
self
.
_n_tries
+=
1
elif
self
.
__operation_metadata
.
stage
==
OperationStage
.
COMPLETED
.
value
:
...
...
This diff is collapsed.
Click to expand it.
tests/integration/operations_service.py
+
2
−
1
View file @
68723d8c
...
...
@@ -144,7 +144,8 @@ def test_list_operations_with_result(instance, controller, execute_request, cont
execute_response
=
remote_execution_pb2
.
ExecuteResponse
()
response
.
operations
[
0
].
response
.
Unpack
(
execute_response
)
assert
execute_response
.
result
==
action_result
assert
execute_response
.
result
.
output_files
==
action_result
.
output_files
def
test_list_operations_empty
(
instance
,
context
):
...
...
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