From 60fa75d4ee37eac352dd1c7593ac77af487a3c4b Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Tue, 23 Jun 2020 16:34:53 -0700 Subject: [PATCH] Bug 1646753 - Increase size of job_type.name field (#6539) --- schemas/pulse-job.yml | 2 +- tests/etl/test_job_loader.py | 19 +++++++++++++++++ treeherder/etl/taskcluster_pulse/handler.py | 4 ++-- .../0019_increase_job_type_name_length.py | 21 +++++++++++++++++++ treeherder/model/models.py | 4 ++-- 5 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 treeherder/model/migrations/0019_increase_job_type_name_length.py diff --git a/schemas/pulse-job.yml b/schemas/pulse-job.yml index a5b6aae0d..89e1b6c1b 100644 --- a/schemas/pulse-job.yml +++ b/schemas/pulse-job.yml @@ -117,7 +117,7 @@ properties: title: 'Job Name' type: 'string' minLength: 1 - maxLength: 100 + maxLength: 140 groupName: title: 'Group Name' type: 'string' diff --git a/tests/etl/test_job_loader.py b/tests/etl/test_job_loader.py index 727589c82..6acfd9a93 100644 --- a/tests/etl/test_job_loader.py +++ b/tests/etl/test_job_loader.py @@ -149,6 +149,25 @@ def test_ingest_pulse_jobs( ] == logs_expected +def test_ingest_pulse_job_with_long_job_type_name( + pulse_jobs, test_repository, push_stored, failure_classifications, mock_log_parser +): + """ + Ingest a job through the JSON Schema validated JobLoader used by Pulse + """ + job = pulse_jobs[0] + jl = JobLoader() + revision = push_stored[0]["revision"] + job["display"][ + "jobName" + ] = "this is a very long string that exceeds the 100 character size that was the previous limit by just a little bit" + job["origin"]["revision"] = revision + jl.process_job(job, 'https://firefox-ci-tc.services.mozilla.com') + + jobs = Job.objects.all() + assert len(jobs) == 1 + + def test_ingest_pending_pulse_job( pulse_jobs, push_stored, failure_classifications, mock_log_parser ): diff --git a/treeherder/etl/taskcluster_pulse/handler.py b/treeherder/etl/taskcluster_pulse/handler.py index d80850734..9a313dbb0 100644 --- a/treeherder/etl/taskcluster_pulse/handler.py +++ b/treeherder/etl/taskcluster_pulse/handler.py @@ -192,8 +192,8 @@ def buildMessage(pushInfo, task, runId, payload): # for treeherder "jobSymbol": str(treeherderConfig["symbol"]), "groupSymbol": treeherderConfig.get("groupSymbol", "?"), - # Maximum job name length is 100 chars... - "jobName": task["metadata"]["name"][0:99], + # Maximum job name length is 140 chars... + "jobName": task["metadata"]["name"][0:139], }, "state": stateFromRun(jobRun), "result": resultFromRun(jobRun), diff --git a/treeherder/model/migrations/0019_increase_job_type_name_length.py b/treeherder/model/migrations/0019_increase_job_type_name_length.py new file mode 100644 index 000000000..2142131b3 --- /dev/null +++ b/treeherder/model/migrations/0019_increase_job_type_name_length.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.7 on 2020-06-18 17:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('model', '0018_delete_jobdetail'), + ] + + operations = [ + migrations.AlterField( + model_name='jobtype', name='name', field=models.CharField(max_length=140), + ), + migrations.AlterField( + model_name='referencedatasignatures', + name='job_type_name', + field=models.CharField(db_index=True, max_length=140), + ), + ] diff --git a/treeherder/model/models.py b/treeherder/model/models.py index 16d6bd138..4388c50d3 100644 --- a/treeherder/model/models.py +++ b/treeherder/model/models.py @@ -365,7 +365,7 @@ class OptionCollection(models.Model): class JobType(models.Model): id = models.AutoField(primary_key=True) symbol = models.CharField(max_length=25, default='?', db_index=True) - name = models.CharField(max_length=100) + name = models.CharField(max_length=140) description = models.TextField(blank=True) class Meta: @@ -401,7 +401,7 @@ class ReferenceDataSignatures(models.Model): machine_architecture = models.CharField(max_length=25, db_index=True) job_group_name = models.CharField(max_length=100, blank=True, db_index=True) job_group_symbol = models.CharField(max_length=25, blank=True, db_index=True) - job_type_name = models.CharField(max_length=100, db_index=True) + job_type_name = models.CharField(max_length=140, db_index=True) job_type_symbol = models.CharField(max_length=25, blank=True, db_index=True) option_collection_hash = models.CharField(max_length=64, blank=True, db_index=True) build_system_type = models.CharField(max_length=25, blank=True, db_index=True)