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
buildstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
1d0c9973
Commit
1d0c9973
authored
6 years ago
by
Jürg Billeter
Browse files
Options
Downloads
Patches
Plain Diff
WIP: sandbox/_sandboxremote.py: Implement command batching
parent
70d56a40
No related branches found
No related tags found
Loading
Pipeline
#32043110
failed
6 years ago
Stage: prepare
Stage: test
Stage: post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildstream/sandbox/_sandboxremote.py
+37
-0
37 additions, 0 deletions
buildstream/sandbox/_sandboxremote.py
with
37 additions
and
0 deletions
buildstream/sandbox/_sandboxremote.py
+
37
−
0
View file @
1d0c9973
...
...
@@ -19,6 +19,7 @@
# Jim MacArthur <jim.macarthur@codethink.co.uk>
import
os
import
shlex
from
urllib.parse
import
urlparse
import
grpc
...
...
@@ -230,3 +231,39 @@ class SandboxRemote(Sandbox):
self
.
process_job_output
(
action_result
.
output_directories
,
action_result
.
output_files
)
return
0
def
run_queue
(
self
,
flags
,
*
,
cwd
=
None
,
env
=
None
):
queue
=
self
.
_queue
self
.
_queue
=
[]
script
=
""
i
=
0
for
entry
in
queue
:
if
entry
.
command
:
cmdline
=
'
'
.
join
(
shlex
.
quote
(
cmd
)
for
cmd
in
entry
.
command
)
script
+=
"
({})
\n
"
.
format
(
cmdline
)
script
+=
"
RETVAL=$?
\n
"
script
+=
"
if [ $RETVAL -ne 0 ] ; then
\n
"
# Report failing command and exit code to stderr (and then back to client)
script
+=
"
echo -e
'
\n
bst-command-failure:
'
{} $RETVAL >&2
\n
"
.
format
(
i
)
script
+=
"
exit 1
\n
"
script
+=
"
fi
\n
"
i
+=
1
exit_code
=
self
.
run
([
'
sh
'
,
'
-c
'
,
script
],
flags
,
cwd
=
cwd
,
env
=
env
)
if
exit_code
!=
0
:
# TODO get failed command and exit code from stderr
failed_command
=
0
command_exit_code
=
1
i
=
0
for
entry
in
queue
:
entry
.
start_callback
()
if
exit_code
==
0
or
i
<
failed_command
:
# Command succeeded
entry
.
complete_callback
(
0
)
else
:
# Command failed
entry
.
complete_callback
(
command_exit_code
)
break
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