Add information of tasks and instances to job_list api at the backend

This commit is contained in:
zhuyj17 2018-11-18 00:03:19 +08:00
parent 027e30a624
commit 4c38ef6948
2 changed files with 15 additions and 65 deletions

View File

@ -105,11 +105,17 @@ class JobMgr(threading.Thread):
job = self.job_map[job_id] job = self.job_map[job_id]
logger.debug('job_id: %s, user: %s' % (job_id, job.user)) logger.debug('job_id: %s, user: %s' % (job_id, job.user))
if job.user == user: if job.user == user:
all_tasks = job.raw_job_info['tasks']
tasks_instCount = {}
for task in all_tasks.keys():
tasks_instCount[task] = int(all_tasks[task]['instCount'])
res.append({ res.append({
'job_name': job.job_name, 'job_name': job.job_name,
'job_id': job.job_id, 'job_id': job.job_id,
'status': job.status, 'status': job.status,
'create_time': job.create_time 'create_time': job.create_time,
'tasks': list(all_tasks.keys()),
'tasks_instCount': tasks_instCount
}) })
return res return res

View File

@ -50,72 +50,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for taskid in job_info['tasks'] %}
{% for instid in range(job_info['tasks_instCount'][taskid]) %}
<tr> <tr>
<td>10</td> <td>{{ taskid }}</td>
<td>10</td> <td>{{ instid }}</td>
<td>10</td> <td><a class="btn btn-info btn-xs" href='/batch_job/{{ job_info["job_id"] }}/{{ taskid }}/{{ instid }}/stdout/' target="_blank">Stdout</a></td>
<td>10</td> <td><a class="btn btn-info btn-xs" href='/batch_job/{{ job_info["job_id"] }}/{{ taskid }}/{{ instid }}/stdout/' target="_blank">Stderr</a></td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
<td>10</td>
<td>10</td>
</tr> </tr>
{% endfor %}
{% endfor %}
</tbody> </tbody>
</table> </table>
<div class="modal-footer"> <div class="modal-footer">