Skip to content

Commit e7a417c

Browse files
committed
fix
1 parent 74cc48f commit e7a417c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ci/fireci/fireciplugins/macrobenchmark.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import random
2121
import sys
2222

23+
import click
2324
import pystache
2425
import shutil
2526
import yaml
@@ -56,7 +57,7 @@ async def _parse_artifact_versions():
5657
proc = await asyncio.subprocess.create_subprocess_exec('./gradlew', 'assembleAllForSmokeTests')
5758
await proc.wait()
5859

59-
with open('build/m2repository/changed-artifacts.json', 'r') as json_file:
60+
with open('build/m2repository/changed-artifacts.json') as json_file:
6061
artifacts = json.load(json_file)
6162
return dict(_artifact_key_version(x) for x in artifacts['headGit'])
6263

@@ -67,7 +68,7 @@ def _artifact_key_version(artifact):
6768

6869

6970
async def _parse_config_yaml():
70-
with open('macrobenchmark/config.yaml', 'r') as yaml_file:
71+
with open('macrobenchmark/config.yaml') as yaml_file:
7172
return yaml.safe_load(yaml_file)
7273

7374

@@ -167,7 +168,8 @@ async def _upload_apks_to_ftl(self):
167168
await self._exec_subprocess(executable, args)
168169

169170
async def _exec_subprocess(self, executable, args):
170-
self.logger.info(f'Executing command: "{" ".join([executable, *args])}"...')
171+
command = " ".join([executable, *args])
172+
self.logger.info(f'Executing command: "{command}"...')
171173

172174
proc = await asyncio.subprocess.create_subprocess_exec(
173175
executable,
@@ -180,6 +182,14 @@ async def _exec_subprocess(self, executable, args):
180182
self._stream_output(executable, proc.stderr)
181183
)
182184

185+
await proc.communicate()
186+
if proc.returncode == 0:
187+
self.logger.info(f'"{command}" finished.')
188+
else:
189+
message = f'"{command}" exited with return code {proc.returncode}.'
190+
self.logger.error(message)
191+
raise click.ClickException(message)
192+
183193
async def _stream_output(self, executable, stream: asyncio.StreamReader):
184194
async for line in stream:
185195
self.logger.info(f'[{executable}] {line.decode("utf-8").strip()}')

0 commit comments

Comments
 (0)