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
3
Snippets
Groups
Projects
Show more breadcrumbs
BuildGrid
buildgrid
Commits
c5b1d467
Commit
c5b1d467
authored
6 years ago
by
Martin Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
cmd_execute.py: Port to new CAS downloader helper
#79
parent
0facefbb
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildgrid/_app/commands/cmd_execute.py
+10
-20
10 additions, 20 deletions
buildgrid/_app/commands/cmd_execute.py
with
10 additions
and
20 deletions
buildgrid/_app/commands/cmd_execute.py
+
10
−
20
View file @
c5b1d467
...
...
@@ -20,7 +20,6 @@ Execute command
Request work to be executed and monitor status of jobs.
"""
import
errno
import
logging
import
os
import
stat
...
...
@@ -30,10 +29,8 @@ from urllib.parse import urlparse
import
click
import
grpc
from
buildgrid.client.cas
import
upload
from
buildgrid.client.cas
import
download
,
upload
from
buildgrid._protos.build.bazel.remote.execution.v2
import
remote_execution_pb2
,
remote_execution_pb2_grpc
from
buildgrid._protos.google.bytestream
import
bytestream_pb2_grpc
from
buildgrid.utils
import
write_fetch_blob
from
..cli
import
pass_context
...
...
@@ -143,8 +140,6 @@ def run_command(context, input_root, commands, output_file, output_directory):
skip_cache_lookup
=
True
)
response
=
stub
.
Execute
(
request
)
stub
=
bytestream_pb2_grpc
.
ByteStreamStub
(
context
.
channel
)
stream
=
None
for
stream
in
response
:
context
.
logger
.
info
(
stream
)
...
...
@@ -152,20 +147,15 @@ def run_command(context, input_root, commands, output_file, output_directory):
execute_response
=
remote_execution_pb2
.
ExecuteResponse
()
stream
.
response
.
Unpack
(
execute_response
)
with
download
(
context
.
channel
,
instance
=
context
.
instance_name
)
as
downloader
:
for
output_file_response
in
execute_response
.
result
.
output_files
:
path
=
os
.
path
.
join
(
output_directory
,
output_file_response
.
path
)
if
not
os
.
path
.
exists
(
os
.
path
.
dirname
(
path
)):
os
.
makedirs
(
os
.
path
.
dirname
(
path
),
exist_ok
=
True
)
try
:
os
.
makedirs
(
os
.
path
.
dirname
(
path
))
except
OSError
as
exc
:
if
exc
.
errno
!=
errno
.
EEXIST
:
raise
with
open
(
path
,
'
wb+
'
)
as
f
:
write_fetch_blob
(
f
,
stub
,
output_file_response
.
digest
,
context
.
instance_name
)
downloader
.
download_file
(
output_file_response
.
digest
,
path
)
if
output_file_response
.
path
in
output_executeables
:
st
=
os
.
stat
(
path
)
...
...
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