Skip to content

Commit

Permalink
First attempt at fixing DB error propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilton-ttam committed Jan 5, 2021
1 parent b656d42 commit 82f6902
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions services/metadata_service/api/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,13 @@ async def get_artifacts_by_task(self, request):
flow_name, run_number, step_name, task_id
)

filtered_body = ArtificatsApi._filter_artifacts_by_attempt_id(
artifacts.body)
if artifacts.response_code == 200:
body = ArtificatsApi._filter_artifacts_by_attempt_id(
artifacts.body)
else:
body = artifacts.body
return web.Response(
status=artifacts.response_code, body=json.dumps(filtered_body)
status=artifacts.response_code, body=json.dumps(body)
)

async def get_artifacts_by_step(self, request):
Expand Down Expand Up @@ -180,10 +183,13 @@ async def get_artifacts_by_step(self, request):
flow_name, run_number, step_name
)

filtered_body = ArtificatsApi._filter_artifacts_by_attempt_id(
artifacts.body)
if artifacts.response_code == 200:
body = ArtificatsApi._filter_artifacts_by_attempt_id(
artifacts.body)
else:
body = artifacts.body
return web.Response(
status=artifacts.response_code, body=json.dumps(filtered_body)
status=artifacts.response_code, body=json.dumps(body)
)

async def get_artifacts_by_run(self, request):
Expand Down Expand Up @@ -215,10 +221,13 @@ async def get_artifacts_by_run(self, request):
run_number = request.match_info.get("run_number")

artifacts = await self._async_table.get_artifacts_in_runs(flow_name, run_number)
filtered_body = ArtificatsApi._filter_artifacts_by_attempt_id(
artifacts.body)
if artifacts.response_code == 200:
body = ArtificatsApi._filter_artifacts_by_attempt_id(
artifacts.body)
else:
body = artifacts.body
return web.Response(
status=artifacts.response_code, body=json.dumps(filtered_body)
status=artifacts.response_code, body=json.dumps(body)
)

async def create_artifacts(self, request):
Expand Down

0 comments on commit 82f6902

Please sign in to comment.