Changeset 13719 for branches/WebJobManager
- Timestamp:
- 03/18/16 16:30:39 (9 years ago)
- Location:
- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/JobUpdaterHub.cs
r13714 r13719 1 1 using HeuristicLab.Clients.Hive.WebJobManager.Services; 2 using HeuristicLab.Common; 2 3 using Microsoft.AspNet.SignalR; 3 4 using Newtonsoft.Json; 4 5 using System; 5 6 using System.Collections.Generic; 6 using System.Linq;7 using System.Threading.Tasks;8 using HeuristicLab.Clients.Hive.WebJobManager.Services;9 7 10 8 namespace HeuristicLab.Clients.Hive.WebJobManager … … 12 10 public class JobUpdaterHub : Hub 13 11 { 12 14 13 private RefreshableJob Job; 14 15 15 16 16 public void initConnection() 17 17 { 18 FileOpeningService.Instance.previousids = new List<Guid>(); 19 FileOpeningService.Instance.previousLogs = new List<int>(); 18 20 Job = FileOpeningService.Instance.Job; 19 } 20 public void sendUpdate() 21 { 22 Clients.All.sendUpdate(); 21 updateAll(); 22 23 23 } 24 24 public void updateAll() … … 26 26 FileOpeningService.Instance.refreshJob(); 27 27 Job = FileOpeningService.Instance.Job; 28 28 29 29 foreach (var t in Job.HiveTasks) 30 30 { … … 38 38 try 39 39 { 40 JsonSerializerSettings settings = new JsonSerializerSettings(); 41 settings.ContractResolver = new JsonTaskResolver(); 42 var json = JsonConvert.SerializeObject(task.Task, settings); 43 Clients.All.processData(task.Task.Id,json ); 40 int index; 41 bool test = false; 42 if (FileOpeningService.Instance.previousids.Contains(task.Task.Id)) 43 { 44 index = FileOpeningService.Instance.previousids.IndexOf(task.Task.Id); 45 } 46 else 47 { 48 FileOpeningService.Instance.previousids.Add(task.Task.Id); 49 index = FileOpeningService.Instance.previousids.IndexOf(task.Task.Id); 50 FileOpeningService.Instance.previousLogs.Add(task.Task.StateLog.Count); 51 test = true; 52 } 53 var previous = FileOpeningService.Instance.previousLogs[index]; 54 if (test || previous < task.Task.StateLog.Count) 55 { 56 FileOpeningService.Instance.previousLogs[index] = task.Task.StateLog.Count; 57 JsonSerializerSettings settings = new JsonSerializerSettings(); 58 settings.ContractResolver = new JsonTaskResolver(); 59 var json = JsonConvert.SerializeObject(task.Task, settings); 60 Clients.All.processData(task.Task.Id, json); 61 } 44 62 foreach (var t in task.ChildHiveTasks) 45 63 { -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/FileOpeningService.cs
r13714 r13719 14 14 public FileOpeningViewModel vm { get; set; } 15 15 public IHostingEnvironment env { get; set; } 16 public List<Guid> previousids { 17 get; set; } 18 public List<int> previousLogs { get; set; } 16 19 private static FileOpeningService instance; 17 20 public static FileOpeningService Instance -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/Index.cshtml
r13714 r13719 91 91 <script src="~/js/scripts/graphs/graphdatacollector.js"></script> 92 92 <script src="~/js/scripts/graphs/graphhubber.js"></script> 93 <div class="row"> 94 <div class="btn btn-lg btn-info" onclick="redrawMain()">Refresh main graph</div> 95 <div id="graphMain" style="width:100%;height:400px"> 93 96 97 </div> 98 </div> 94 99 <div class="row" > 95 100 <h3 style="padding-left:20px; ">Tasks</h3> -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/SelectedJobPartials/_AlgTask.cshtml
r13714 r13719 82 82 @Html.Raw(JsonConvert.SerializeObject(Model.hiveTask.Task.StateLog))); 83 83 84 document.getElementById("graph@(Model.hiveTask.Task.Id)").style = "width: 90%; height: 450px;";84 document.getElementById("graph@(Model.hiveTask.Task.Id)").style = "width: 100%; height: 400px;"; 85 85 86 86 Plotly.newPlot('graph@(Model.hiveTask.Task.Id)', -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/SelectedJobPartials/_BatchTask.cshtml
r13714 r13719 74 74 type="checkbox" 75 75 data-toggle="toggle" 76 checked77 76 data-on="Line" 78 77 data-off="Pie" … … 99 98 @Html.Raw(JsonConvert.SerializeObject(Model.hiveTask.Task.StateLog))); 100 99 101 document.getElementById("graph@(Model.hiveTask.Task.Id)").style = "width: 90%; height: 450px;";100 document.getElementById("graph@(Model.hiveTask.Task.Id)").style = "width: 100%; height: 400px;"; 102 101 103 102 Plotly.newPlot('graph@(Model.hiveTask.Task.Id)', -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/SelectedJobPartials/_ExpTask.cshtml
r13714 r13719 76 76 type="checkbox" 77 77 data-toggle="toggle" 78 checked78 79 79 data-on="Line" 80 80 data-off="Pie" … … 101 101 @Html.Raw(JsonConvert.SerializeObject(Model.hiveTask.Task.StateLog))); 102 102 103 document.getElementById("graph@(Model.hiveTask.Task.Id)").style = "width: 90%; height: 450px;";103 document.getElementById("graph@(Model.hiveTask.Task.Id)").style = "width: 100%!important; height: 400px;"; 104 104 105 105 Plotly.newPlot('graph@(Model.hiveTask.Task.Id)', -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphDataCollector.js
r13714 r13719 15 15 } 16 16 } 17 console.log("#SAVEDATA: " + id);17 //console.log("#SAVEDATA: " + id); 18 18 redrawGraph(id); 19 19 } … … 34 34 } 35 35 function dataConversion(coll) { 36 37 38 return [dataConversionLine(coll),dataConversionPie(coll)]; 39 } 40 function dataConversionLine(coll) { 36 41 var xarr = []; 37 42 var yarr = []; 38 var waiting = 0; 39 var transfer = 0; 40 var calc = 0; 43 for (var v = 0; v < coll.length; v++) { 44 xarr.push(Date.parse(coll[v].DateTime)); 45 if (coll[v].State == 1) 46 yarr.push("Waiting"); 47 else if (coll[v].State == 2) 48 yarr.push("Transferring"); 49 else if (coll[v].State == 3) 50 yarr.push("Calculating"); 51 else if (coll[v].State == 5) 52 yarr.push("Finished"); 53 else if (coll[v].State == 7) 54 yarr.push("Failed"); 55 } 56 var data = [{//Time graph 57 x: xarr, 58 y: yarr, 59 type: 'scatter', 60 mode: 'lines', 61 name: 'Task ' , 62 connectgaps:true, 63 line:{shape:'hv'} 64 }]; 65 layout= { 66 "showlegend": true, 67 "width": "100%", 68 "xaxis": { 69 "autorange": true, 70 "range": [ 71 Date.parse(coll[0].DateTime), 72 Date.parse(coll[coll.length -1].DateTime) 73 ], 74 "title": "Time", 75 "type": "date" 76 } 77 78 } 79 80 return [data,layout]; 81 } 82 function dataConversionHBar(coll) { 83 var xarr = []; 84 var yarr = []; 41 85 for (var v = 0; v < coll.length; v++) { 42 86 xarr.push(coll[v].DateTime.substr(11, 8)); 43 if (coll[v].State == 1) {87 if (coll[v].State == 1) 44 88 yarr.push("Waiting"); 45 if (v < (coll.length - 1)) 46 waiting += Date.parse(coll[v + 1].DateTime) - Date.parse(coll[v].DateTime); 47 } 48 else if (coll[v].State == 2) { 89 else if (coll[v].State == 2) 49 90 yarr.push("Transferring"); 50 if (v < (coll.length - 1)) 51 transfer += Date.parse(coll[v + 1].DateTime) - Date.parse(coll[v].DateTime); 52 } 53 else if (coll[v].State == 3) { 91 else if (coll[v].State == 3) 54 92 yarr.push("Calculating"); 55 if (v < (coll.length - 1))56 calc += Date.parse(coll[v + 1].DateTime) - Date.parse(coll[v].DateTime);57 }58 93 else if (coll[v].State == 5) 59 94 yarr.push("Finished"); … … 66 101 type: 'scatter' 67 102 }]; 103 104 return data; 105 } 106 function dataConversionPie(coll) { 107 var waiting = 0; 108 var transfer = 0; 109 var calc = 0; 110 for (var v = 0; v < coll.length-1; v++) { 111 if(coll[v].State == 1) 112 waiting += Date.parse(coll[v + 1].DateTime) - Date.parse(coll[v].DateTime); 113 else if (coll[v].State == 2) 114 transfer += Date.parse(coll[v + 1].DateTime) - Date.parse(coll[v].DateTime); 115 else if (coll[v].State == 3) 116 calc += Date.parse(coll[v + 1].DateTime) - Date.parse(coll[v].DateTime); 117 } 68 118 var datap = [{//Pie graph 69 119 values: [ … … 77 127 type: 'pie' 78 128 }]; 79 return [data, datap];129 return datap; 80 130 } 81 131 82 132 function redrawGraph(val) { 133 document.getElementById("graph" + val).style.width = "100%"; 134 document.getElementById("graph" + val).style.height = "400px"; 83 135 if (document.getElementById("graphtoggle" + val).checked) { 84 136 setTimeout(function () { 85 Plotly.newPlot('graph' + val, getData(val) );137 Plotly.newPlot('graph' + val, getData(val)[0], getData(val)[1]); 86 138 }, 100); 87 139 console.log("#REDRAWN LINE: " + val); … … 90 142 Plotly.newPlot('graph' + val, getDataPie(val)); 91 143 }, 100); 92 console.log("#REDRAWN PIE: " + val);144 //console.log("#REDRAWN PIE: " + val); 93 145 } 146 94 147 95 148 } 149 function redrawMain() { 150 var temp = []; 151 var min = dataCollection[0][1][0][0].x[0]; 152 var max = min; 153 for (var i = 0; i < dataCollection.length; i++) { 154 temp.push(dataCollection[i][1][0][0]); 155 if (dataCollection[i][1][0][0].x[dataCollection[i][1][0][0].x.length - 1] > max) 156 max = dataCollection[i][1][0][0].x[dataCollection[i][1][0][0].x.length - 1]; 157 if (dataCollection[i][1][0][0].x[0] < min) 158 min = dataCollection[i][1][0][0].x[0]; 159 } 160 layout = { 161 "showlegend": true, 162 "title": new Date(min).toUTCString() + " to " + new Date(max).toUTCString(), 163 "xaxis": { 164 "autorange": true, 165 "range": [ 166 min, 167 max 168 ], 169 "title": "Time", 170 "type": "date" 171 } 172 173 } 174 Plotly.newPlot('graphMain', temp, layout); 175 176 177 } -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphHubber.js
r13714 r13719 6 6 hubber.server.initConnection(); 7 7 hubber.server.updateAll(); 8 8 redrawMain(); 9 9 }); 10 10 hubber.client.processData = function (id, data) { … … 13 13 saveData(id, obj.StateLog); 14 14 } 15 hubber.client.requestDone = function(){ 15 hubber.client.requestDone = function () { 16 16 17 setTimeout(function () { 17 18 hubber.server.updateAll(); 19 console.log("#REFRESH ALL"); 20 18 21 }, 5000); 19 22 } … … 22 25 23 26 function editTaskData(id, task) { 24 console.log(task);25 27 //lastupdate 26 28 var dat = new Date(task.LastHeartbeat); … … 54 56 }); 55 57 $("#statepar" + id).html("State: Finished"); 56 console.log(task.DateFinished);57 58 var datf = new Date(task.StateLog[task.StateLog.length -1].DateTime); 58 59 $("#lastupdpar" + id).html("Finished: " + datf.toUTCString());
Note: See TracChangeset
for help on using the changeset viewer.