1
0
mirror of https://github.com/newnius/YAO-portal.git synced 2025-06-07 07:31:56 +00:00
This commit is contained in:
Newnius 2020-06-24 23:46:23 +08:00
parent 0e0c5a6f1e
commit 3f18c36868

View File

@ -67,8 +67,10 @@ function register_events_job() {
} }
}); });
var roles = ['PS', 'Worker'];
$.each(roles, function (i, role) {
var ajax = $.ajax({ var ajax = $.ajax({
url: "service?action=job_predict_req&role=PS", url: "service?action=job_predict_req&role=" + role,
type: 'POST', type: 'POST',
data: { data: {
name: name, name: name,
@ -88,9 +90,12 @@ function register_events_job() {
console.log(res); console.log(res);
$('#form-job-tasks').find('.row').each(function () { $('#form-job-tasks').find('.row').each(function () {
if ((role === 'PS' && $(this).find('.task-cpu').eq(0).val() === 1)
|| (role === 'Worker' && $(this).find('.task-cpu').eq(0).val() === 0)) {
$(this).find('.task-cpu').eq(0).val(res['cpu']); $(this).find('.task-cpu').eq(0).val(res['cpu']);
$(this).find('.task-mem').eq(0).val(res['mem']); $(this).find('.task-mem').eq(0).val(res['mem']);
$(this).find('.task-gpu-mem').eq(0).val(res['gpu_mem']); $(this).find('.task-gpu-mem').eq(0).val(res['gpu_mem']);
}
}); });
} }
}); });
@ -99,6 +104,8 @@ function register_events_job() {
$("#modal-msg").modal('show'); $("#modal-msg").modal('show');
$('#table-job').bootstrapTable("refresh"); $('#table-job').bootstrapTable("refresh");
}); });
});
}); });
$('#form-job-task-add').click(function (e) { $('#form-job-task-add').click(function (e) {
@ -144,7 +151,6 @@ function register_events_job() {
$('#modal-job').modal('hide'); $('#modal-job').modal('hide');
var ajax = $.ajax({ var ajax = $.ajax({
url: "service?action=job_submit", url: "service?action=job_submit",
type: 'POST', type: 'POST',