Commit 282b9c2e authored by Neil Williams's avatar Neil Williams Committed by Remi Duraffort
Browse files

LAVA-739 - declare sub_id and job.id for multinode

Change-Id: I3f25061e40beacc18c004592fe573cd65a8f81aa
parent b5c1e89d
......@@ -602,11 +602,19 @@ class SchedulerAPI(ExposedAPI):
except TestJob.DoesNotExist:
raise xmlrpclib.Fault(404, "Specified job not found.")
job_status = {'job_id': job.id}
if job.is_multinode:
job_status.update({
'sub_id': job.sub_id
})
if job.is_pipeline:
return {
job_status.update({
'job_status': job.get_status_display(),
'bundle_sha1': ""
}
})
return job_status
# DEPRECATED
bundle_sha1 = ""
......@@ -616,10 +624,10 @@ class SchedulerAPI(ExposedAPI):
except IndexError:
pass
job_status = {
job_status.update({
'job_status': job.get_status_display(),
'bundle_sha1': bundle_sha1
}
})
return job_status
......
......@@ -96,7 +96,7 @@ def testjob_post_handler(sender, **kwargs):
# Create the message
data = {
"status": instance.STATUS_CHOICES[instance.status][1],
"job": instance.display_id,
"job": instance.id,
"description": instance.description,
"priority": instance.priority,
"submit_time": instance.submit_time.isoformat(),
......@@ -104,6 +104,8 @@ def testjob_post_handler(sender, **kwargs):
"visibility": instance.VISIBLE_CHOICES[instance.visibility][1],
"pipeline": instance.is_pipeline,
}
if instance.is_multinode:
data['sub_id'] = instance.sub_id
if instance.health_check:
data['health_check'] = True
if instance.requested_device:
......
......@@ -252,6 +252,7 @@ class JobTable(LavaTable):
# note the enums cannot be searched this way.
searches = {
'id': 'contains',
'sub_id': 'contains',
'description': 'contains'
}
# dedicated time-based search fields
......
......@@ -191,6 +191,7 @@
{% if '0' in subjob.sub_id and '0' not in job.sub_id %}
<abbr title="view job {{ subjob.sub_id }} to see the result bundle, if any.">(?)</abbr>
{% endif %}
({{ subjob.id }})
</dt>
<dd>
{% if subjob.actual_device.hostname %}
......
......@@ -183,6 +183,7 @@
{% if '0' in subjob.sub_id and '0' not in job.sub_id %}
<abbr title="view job {{ subjob.sub_id }} to see the result bundle, if any.">(?)</abbr>
{% endif %}
({{ subjob.id }})
</dt>
<dd>
{% if subjob.actual_device.hostname %}
......
......@@ -170,6 +170,7 @@
{% if '0' in subjob.sub_id and '0' not in job.sub_id %}
<abbr title="view job {{ subjob.sub_id }} to see the result bundle, if any.">(?)</abbr>
{% endif %}
({{ subjob.id }})
</dt>
<dd>
{% if subjob.actual_device.hostname %}
......
......@@ -84,6 +84,7 @@
{% if '0' in subjob.sub_id and '0' not in job.sub_id %}
<abbr title="view job {{ subjob.sub_id }} to see the results, if any.">(?)</abbr>
{% endif %}
({{ subjob.id }})
</dt>
<dd>
{% if subjob.actual_device.hostname %}
......
......@@ -101,6 +101,7 @@
{% if '0' in subjob.sub_id and '0' not in job.sub_id %}
<abbr title="view job {{ subjob.sub_id }} to see the result bundle, if any.">(?)</abbr>
{% endif %}
({{ subjob.id }})
</dt>
<dd>
{% if subjob.actual_device.hostname %}
......
......@@ -80,6 +80,7 @@
{% if '0' in subjob.sub_id and '0' not in job.sub_id %}
<abbr title="view job {{ subjob.sub_id }} to see the result bundle, if any.">(?)</abbr>
{% endif %}
({{ subjob.id }})
</dt>
<dd>
{% if subjob.actual_device.hostname %}
......
......@@ -105,8 +105,14 @@ class TestTestJobTable(TestCase):
view = TestJobView(None, model=TestJob, table_class=TestJobTable)
table = TestJobTable(view.get_table_data())
logging.debug("Passing a model and table_class to get search data")
self.assertEqual(table.prepare_search_data(view),
{'search': ['Description', 'device', 'ID', 'status', 'submitter']})
proxied = {}
for key, value in table.prepare_search_data(view).items():
proxied[key] = []
if isinstance(value, list):
for item in value:
proxied[key].append(str(item))
self.assertEqual(proxied,
{'search': ['Description', 'device', 'ID', 'status', 'Sub ID', 'submitter']})
self.assertEqual(table.prepare_terms_data(view), {'terms': {}})
self.assertEqual(table.prepare_times_data(view), {'times': ['End time (hours)', 'Submit time (hours)']})
......@@ -126,8 +132,15 @@ class TestPrefixJobTable(TestCase):
view = TestJobView(None, model=TestJob, table_class=TestJobTable)
table = TestJobTable(view.get_table_data(self.prefix), prefix=self.prefix)
logging.debug("Testing a view with a model and a prefix")
self.assertEqual(table.prepare_search_data(view),
{self.prefix: ['Description', 'device', 'ID', 'status', 'submitter']})
proxied = {}
for key, value in table.prepare_search_data(view).items():
proxied[key] = []
if isinstance(value, list):
for item in value:
proxied[key].append(str(item))
self.assertEqual(proxied,
{self.prefix: ['Description', 'device', 'ID', 'status', 'Sub ID', 'submitter']})
self.assertEqual(table.prepare_terms_data(view), {self.prefix: {}})
self.assertEqual(table.prepare_times_data(view), {self.prefix: ['End time (hours)', 'Submit time (hours)']})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment