diff options
author | Senthil Kumaran S <senthil.kumaran@linaro.org> | 2017-12-14 15:24:37 +0530 |
---|---|---|
committer | Senthil Kumaran S <senthil.kumaran@linaro.org> | 2017-12-14 15:24:37 +0530 |
commit | 2d427a84f649e46cd4bd675b1ab87c530737dae0 (patch) | |
tree | eeaa58b36eadf975e3a268c313b2094dcd6eec45 | |
parent | 849aaa6cd51f7623e5b9efa8b169cc2f6c6730b1 (diff) |
Remove unused job json functions.
JSON is not used for jobs anymore, hence remove references everywhere.
Change-Id: I153fd62e4733b785ff19b7419209809cb2341058
-rw-r--r-- | lava_scheduler_app/tests/test_connections.py | 8 | ||||
-rw-r--r-- | lava_scheduler_app/tests/test_pipeline.py | 29 | ||||
-rw-r--r-- | lava_scheduler_app/urls.py | 3 | ||||
-rw-r--r-- | lava_scheduler_app/views.py | 13 |
4 files changed, 18 insertions, 35 deletions
diff --git a/lava_scheduler_app/tests/test_connections.py b/lava_scheduler_app/tests/test_connections.py index 22f4c7d2a..8c9a4c9f7 100644 --- a/lava_scheduler_app/tests/test_connections.py +++ b/lava_scheduler_app/tests/test_connections.py @@ -42,7 +42,7 @@ class SecondaryConnections(TestCaseWithFactory): device = self.factory.make_device(self.device_type, hostname) try: jobs = TestJob.from_yaml_and_user( - self.factory.make_job_json(), + self.factory.make_job_yaml(), self.factory.make_user()) except DevicesUnavailableException as exc: self.fail(exc) @@ -104,7 +104,7 @@ class SecondaryConnections(TestCaseWithFactory): # create a new device to allow the submission to reach the multinode YAML test. hostname = 'fakeqemu4' self.factory.make_device(self.device_type, hostname) - data = yaml.load(self.factory.make_job_json()) + data = yaml.load(self.factory.make_job_yaml()) data['protocols']['lava-multinode']['roles']['host']['count'] = 2 self.assertRaises( SubmissionException, TestJob.from_yaml_and_user, @@ -116,14 +116,14 @@ class SecondaryConnections(TestCaseWithFactory): # create a new device to allow the submission to reach the multinode YAML test. hostname = 'fakeqemu4' self.factory.make_device(self.device_type, hostname) - data = yaml.load(self.factory.make_job_json()) + data = yaml.load(self.factory.make_job_yaml()) deploy = [action['deploy'] for action in data['actions'] if 'deploy' in action] # replace working image with a broken URL for block in deploy: block['image'] = 'http://localhost/unknown/invalid.gz' try: jobs = TestJob.from_yaml_and_user( - self.factory.make_job_json(), + self.factory.make_job_yaml(), self.factory.make_user()) except DevicesUnavailableException as exc: self.fail(exc) diff --git a/lava_scheduler_app/tests/test_pipeline.py b/lava_scheduler_app/tests/test_pipeline.py index fc3d33a4e..faf7814db 100644 --- a/lava_scheduler_app/tests/test_pipeline.py +++ b/lava_scheduler_app/tests/test_pipeline.py @@ -96,9 +96,6 @@ class YamlFactory(ModelFactory): data.update(kw) return data - def make_job_json(self, **kw): - return self.make_job_yaml(**kw) - def make_job_yaml(self, **kw): return yaml.safe_dump(self.make_job_data(**kw)) @@ -139,13 +136,13 @@ class PipelineDeviceTags(TestCaseWithFactory): def test_no_tags(self): self.factory.make_device(self.device_type, 'fakeqemu3') TestJob.from_yaml_and_user( - self.factory.make_job_json(), + self.factory.make_job_yaml(), self.factory.make_user()) def test_priority(self): self.factory.make_device(self.device_type, 'fakeqemu3') job = TestJob.from_yaml_and_user( - self.factory.make_job_json(), + self.factory.make_job_yaml(), self.factory.make_user()) self.assertEqual(TestJob.LOW, job.priority) @@ -173,7 +170,7 @@ class PipelineDeviceTags(TestCaseWithFactory): self.assertRaises( yaml.YAMLError, TestJob.from_yaml_and_user, - self.factory.make_job_json(tags=['tag1', 'tag2']), + self.factory.make_job_yaml(tags=['tag1', 'tag2']), self.factory.make_user()) def test_from_yaml_unsupported_tags(self): @@ -182,7 +179,7 @@ class PipelineDeviceTags(TestCaseWithFactory): self.factory.ensure_tag('sata') try: TestJob.from_yaml_and_user( - self.factory.make_job_json(tags=['usb', 'sata']), + self.factory.make_job_yaml(tags=['usb', 'sata']), self.factory.make_user()) except DevicesUnavailableException: pass @@ -196,7 +193,7 @@ class PipelineDeviceTags(TestCaseWithFactory): ] self.factory.make_device(self.device_type, hostname='fakeqemu1', tags=tag_list) job = TestJob.from_yaml_and_user( - self.factory.make_job_json(tags=['tag1', 'tag2']), + self.factory.make_job_yaml(tags=['tag1', 'tag2']), self.factory.make_user()) self.assertEqual( set(tag.name for tag in job.tags.all()), {'tag1', 'tag2'}) @@ -206,10 +203,10 @@ class PipelineDeviceTags(TestCaseWithFactory): tags = list(Tag.objects.filter(name='tag')) self.factory.make_device(device_type=self.device_type, hostname="fakeqemu1", tags=tags) job1 = TestJob.from_yaml_and_user( - self.factory.make_job_json(tags=['tag']), + self.factory.make_job_yaml(tags=['tag']), self.factory.make_user()) job2 = TestJob.from_yaml_and_user( - self.factory.make_job_json(tags=['tag']), + self.factory.make_job_yaml(tags=['tag']), self.factory.make_user()) self.assertEqual( set(tag.pk for tag in job1.tags.all()), @@ -230,7 +227,7 @@ class PipelineDeviceTags(TestCaseWithFactory): tag_list.append(self.factory.ensure_tag('unique_tag')) self.factory.make_device(device_type=self.device_type, hostname="fakeqemu2", tags=tag_list) job = TestJob.from_yaml_and_user( - self.factory.make_job_json(tags=['common_tag1', 'common_tag2', 'unique_tag']), + self.factory.make_job_yaml(tags=['common_tag1', 'common_tag2', 'unique_tag']), self.factory.make_user()) self.assertEqual( set(tag for tag in job.tags.all()), @@ -248,14 +245,14 @@ class TestPipelineSubmit(TestCaseWithFactory): self.factory.make_device(device_type=self.device_type, hostname="fakeqemu3") def test_from_yaml_and_user_sets_definition(self): - definition = self.factory.make_job_json() + definition = self.factory.make_job_yaml() job = TestJob.from_yaml_and_user(definition, self.factory.make_user()) self.assertEqual(definition, job.definition) def test_from_yaml_and_user_sets_submitter(self): user = self.factory.make_user() job = TestJob.from_yaml_and_user( - self.factory.make_job_json(), user) + self.factory.make_job_yaml(), user) self.assertEqual(user, job.submitter) self.assertFalse(job.health_check) @@ -360,7 +357,7 @@ class TestPipelineSubmit(TestCaseWithFactory): device = Device.objects.get(hostname="fakeqemu1") user = self.factory.make_user() job = TestJob.from_yaml_and_user( - self.factory.make_job_json(), user) + self.factory.make_job_yaml(), user) job_def = yaml.load(job.definition) job_ctx = job_def.get('context', {}) device_config = device.load_configuration(job_ctx) # raw dict @@ -501,7 +498,7 @@ class TestPipelineSubmit(TestCaseWithFactory): user3 = self.factory.make_user() # public set in the YAML - yaml_str = self.factory.make_job_json() + yaml_str = self.factory.make_job_yaml() yaml_data = yaml.load(yaml_str) job = TestJob.from_yaml_and_user( yaml_str, user) @@ -553,7 +550,7 @@ class TestPipelineSubmit(TestCaseWithFactory): def test_compatibility(self): # pylint: disable=too-many-locals user = self.factory.make_user() # public set in the YAML - yaml_str = self.factory.make_job_json() + yaml_str = self.factory.make_job_yaml() yaml_data = yaml.load(yaml_str) job = TestJob.from_yaml_and_user( yaml_str, user) diff --git a/lava_scheduler_app/urls.py b/lava_scheduler_app/urls.py index 5fb7e7f2a..fa4d2e053 100644 --- a/lava_scheduler_app/urls.py +++ b/lava_scheduler_app/urls.py @@ -11,7 +11,7 @@ from lava_scheduler_app.views import ( get_remote_definition, health_job_list, healthcheck, index, job_annotate_failure, job_cancel, job_change_priority, job_complete_log, job_definition, job_definition_plain, job_description_yaml, job_detail, - job_json, job_list, + job_list, job_log_file_plain, job_log_pipeline_incremental, job_pipeline_timing, job_resubmit, job_section_log, job_status, job_submit, job_toggle_favorite, lab_health, @@ -101,7 +101,6 @@ urlpatterns = [ url(r'^job/(?P<pk>[0-9]+|[0-9]+\.[0-9]+)/toggle_favorite$', job_toggle_favorite, name='lava.scheduler.job.toggle_favorite'), - url(r'^job/(?P<pk>[0-9]+|[0-9]+\.[0-9]+)/json$', job_json, name='lava.scheduler.job.json'), url(r'^job/(?P<pk>[0-9]+|[0-9]+\.[0-9]+)/log_pipeline_incremental$', job_log_pipeline_incremental, name='lava.scheduler.job.log_pipeline_incremental'), diff --git a/lava_scheduler_app/views.py b/lava_scheduler_app/views.py index 5c10df1a3..ed69e7d86 100644 --- a/lava_scheduler_app/views.py +++ b/lava_scheduler_app/views.py @@ -1708,19 +1708,6 @@ def job_annotate_failure(request, pk): request=request)) -def job_json(request, pk): - job = get_restricted_job(request.user, pk, request=request) - json_text = simplejson.dumps({ - 'status': job.get_status_display(), - 'results_link': request.build_absolute_uri(job.results_link), - }) - content_type = 'application/json' - if 'callback' in request.GET: - json_text = '%s(%s)' % (request.GET['callback'], json_text) - content_type = 'text/javascript' - return HttpResponse(json_text, content_type=content_type) - - @post_only def get_remote_definition(request): """Fetches remote job definition file.""" |