Skip to content

Commit

Permalink
Merge pull request #212 from compute-tooling/bump-tb-len
Browse files Browse the repository at this point in the history
Bump allowed traceback length and truncate if its over
  • Loading branch information
hdoupe authored Sep 28, 2019
2 parents 92edd51 + cc81054 commit 8f6f1af
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
25 changes: 25 additions & 0 deletions webapp/apps/comp/migrations/0015_auto_20190928_0840.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 2.2.5 on 2019-09-28 13:40

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [("comp", "0014_auto_20190805_1601")]

operations = [
migrations.AlterField(
model_name="inputs",
name="traceback",
field=models.CharField(
blank=True, default=None, max_length=8000, null=True
),
),
migrations.AlterField(
model_name="simulation",
name="traceback",
field=models.CharField(
blank=True, default=None, max_length=8000, null=True
),
),
]
6 changes: 3 additions & 3 deletions webapp/apps/comp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def from_hashid(self, hashid):

def get_object_from_hashid_or_404(self, hashid):
"""
Get inputs object from a hash of its pk and
Get inputs object from a hash of its pk and
raise 404 exception if it does not exist.
"""
try:
Expand Down Expand Up @@ -78,7 +78,7 @@ class Inputs(models.Model):
owner = models.ForeignKey(
"users.Profile", on_delete=models.CASCADE, null=True, related_name="inputs"
)
traceback = models.CharField(null=True, blank=True, default=None, max_length=4000)
traceback = models.CharField(null=True, blank=True, default=None, max_length=8000)
job_id = models.UUIDField(blank=True, default=None, null=True)
status = models.CharField(
choices=(
Expand Down Expand Up @@ -168,7 +168,7 @@ class Simulation(models.Model):
meta_data = JSONField(default=None, blank=True, null=True)
outputs = JSONField(default=None, blank=True, null=True)
aggr_outputs = JSONField(default=None, blank=True, null=True)
traceback = models.CharField(null=True, blank=True, default=None, max_length=4000)
traceback = models.CharField(null=True, blank=True, default=None, max_length=8000)
owner = models.ForeignKey(
"users.Profile", on_delete=models.CASCADE, null=True, related_name="sims"
)
Expand Down
2 changes: 2 additions & 0 deletions webapp/apps/comp/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,6 @@ def record_outputs(self, sim, data):
else:
sim.status = "FAIL"
sim.traceback = data["traceback"]
if isinstance(sim.traceback, str) and len(sim.traceback) > 8000:
sim.traceback = sim.traceback[:8000]
sim.save()

0 comments on commit 8f6f1af

Please sign in to comment.