Skip to content

Commit

Permalink
portal: catch notebook build not completed
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Sep 1, 2021
1 parent ac6c6fb commit 79c794e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mpcontribs-portal/mpcontribs/portal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,13 @@ def contribution(request, cid):

if "notebook" not in contrib or contrib.get("needs_build", True):
url = f"{client.url}/notebooks/build"
r = requests.get(url, params={"cids": cid})
r = requests.get(url, params={"cids": cid, "force": True})
if r.status_code == requests.codes.ok:
status = r.json().get("result", {}).get("status")
if status != "COMPLETED":
ctx["alert"] = f"Notebook build failed with status {status}"
return render(request, "contribution.html", ctx.flatten())

contrib = client.contributions.get_entry(
pk=cid, _fields=["identifier", "notebook"]
).result()
Expand Down

0 comments on commit 79c794e

Please sign in to comment.