Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Show only succeeded Trials #646

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 55 additions & 53 deletions pkg/ui/v1alpha2/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,33 +231,33 @@ func (k *KatibUIHandler) FetchHPJobInfo(w http.ResponseWriter, r *http.Request)
}
log.Printf("Got Trial List")

resultText += "\n"

for _, t := range trialListResp.Trials {

obsLogResp, err := c.GetObservationLog(
context.Background(),
&api_pb_v1alpha2.GetObservationLogRequest{
TrialName: t.Name,
StartTime: "",
EndTime: "",
},
)
if err != nil {
log.Printf("GetObservationLog from HP job failed: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if t.Status.Condition == api_pb_v1alpha2.TrialStatus_SUCCEEDED {
obsLogResp, err := c.GetObservationLog(
context.Background(),
&api_pb_v1alpha2.GetObservationLogRequest{
TrialName: t.Name,
StartTime: "",
EndTime: "",
},
)
if err != nil {
log.Printf("GetObservationLog from HP job failed: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}

trialResText := make([]string, len(metricsList)+len(paramList))
for _, m := range obsLogResp.ObservationLog.MetricLogs {
trialResText[metricsList[m.Metric.Name]] = m.Metric.Value
trialResText := make([]string, len(metricsList)+len(paramList))
for _, m := range obsLogResp.ObservationLog.MetricLogs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same metricName may exist in obsLogResp.ObservationLog.MetricLogs with different value, do you plan to make trialResText stores last value for each metricName?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop will return only the latest value from obsLogResp.ObservationLog.MetricLogs in trialResText, because they have the same metric name.

trialResText[metricsList[m.Metric.Name]] = m.Metric.Value

}
for _, trialParam := range t.Spec.ParameterAssignments.Assignments {
trialResText[paramList[trialParam.Name]] = trialParam.Value
}
resultText += "\n" + t.Name + "," + strings.Join(trialResText, ",")
}
for _, trialParam := range t.Spec.ParameterAssignments.Assignments {
trialResText[paramList[trialParam.Name]] = trialParam.Value
}
resultText += t.Name + "," + strings.Join(trialResText, ",") + "\n"
}
log.Printf("Logs parsed, result: %v", resultText)
response, err := json.Marshal(resultText)
Expand Down Expand Up @@ -337,41 +337,43 @@ func (k *KatibUIHandler) FetchNASJobInfo(w http.ResponseWriter, r *http.Request)

for i, t := range trialListResp.Trials {

obsLogResp, err := c.GetObservationLog(
context.Background(),
&api_pb_v1alpha2.GetObservationLogRequest{
TrialName: t.Name,
StartTime: "",
EndTime: "",
},
)
if err != nil {
log.Printf("GetObservationLog from NAS job failed: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
metricsName := make([]string, 0)
metricsValue := make([]string, 0)
for _, m := range obsLogResp.ObservationLog.MetricLogs {
metricsName = append(metricsName, m.Metric.Name)
metricsValue = append(metricsValue, m.Metric.Value)
if t.Status.Condition == api_pb_v1alpha2.TrialStatus_SUCCEEDED {
obsLogResp, err := c.GetObservationLog(
context.Background(),
&api_pb_v1alpha2.GetObservationLogRequest{
TrialName: t.Name,
StartTime: "",
EndTime: "",
},
)
if err != nil {
log.Printf("GetObservationLog from NAS job failed: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
metricsName := make([]string, 0)
metricsValue := make([]string, 0)
for _, m := range obsLogResp.ObservationLog.MetricLogs {
metricsName = append(metricsName, m.Metric.Name)
metricsValue = append(metricsValue, m.Metric.Value)

}
for _, trialParam := range t.Spec.ParameterAssignments.Assignments {
if trialParam.Name == "architecture" {
architecture = trialParam.Value
}
if trialParam.Name == "nn_config" {
decoder = trialParam.Value
for _, trialParam := range t.Spec.ParameterAssignments.Assignments {
if trialParam.Name == "architecture" {
architecture = trialParam.Value
}
if trialParam.Name == "nn_config" {
decoder = trialParam.Value
}
}
responseRaw = append(responseRaw, NNView{
Name: "Generation " + strconv.Itoa(i),
TrialName: t.Name,
Architecture: generateNNImage(architecture, decoder),
MetricsName: metricsName,
MetricsValue: metricsValue,
})
}
responseRaw = append(responseRaw, NNView{
Name: "Generation " + strconv.Itoa(i),
TrialName: t.Name,
Architecture: generateNNImage(architecture, decoder),
MetricsName: metricsName,
MetricsValue: metricsValue,
})
}
log.Printf("Logs parsed, result: %v", responseRaw)

Expand Down
4 changes: 2 additions & 2 deletions pkg/ui/v1alpha2/frontend/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"main.js": "./static/js/main.16d6cce4.chunk.js",
"main.js": "./static/js/main.bf4e0f37.chunk.js",
"runtime~main.js": "./static/js/runtime~main.d653cc00.js",
"static/css/2.3e32d45a.chunk.css": "./static/css/2.3e32d45a.chunk.css",
"static/js/2.f25c288f.chunk.js": "./static/js/2.f25c288f.chunk.js",
"index.html": "./index.html",
"precache-manifest.6984ac908418813ab69850ccdffb4cd8.js": "./precache-manifest.6984ac908418813ab69850ccdffb4cd8.js",
"precache-manifest.688d4f0a6a704321c7606d0910c524a0.js": "./precache-manifest.688d4f0a6a704321c7606d0910c524a0.js",
"service-worker.js": "./service-worker.js"
}
2 changes: 1 addition & 1 deletion pkg/ui/v1alpha2/frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script><script type="text/javascript" src="https://d3js.org/d3.v5.min.js"></script><script type="text/javascript" src="https://underscorejs.org/underscore-min.js"></script><script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/mode-xml.js"></script><script src="https://unpkg.com/viz.js@1.8.0/viz.js" type="javascript/worker"></script><meta charset="utf-8"/><link rel="shortcut icon" href="./logo.png"/><meta http-equiv="Access-Control-Allow-Origin" content="*"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><style>body{background-color:#f7f7f7,}</style><title>Katib UI</title><link href="./static/css/2.3e32d45a.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.f25c288f.chunk.js"></script><script src="./static/js/main.16d6cce4.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script><script type="text/javascript" src="https://d3js.org/d3.v5.min.js"></script><script type="text/javascript" src="https://underscorejs.org/underscore-min.js"></script><script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/mode-xml.js"></script><script src="https://unpkg.com/viz.js@1.8.0/viz.js" type="javascript/worker"></script><meta charset="utf-8"/><link rel="shortcut icon" href="./logo.png"/><meta http-equiv="Access-Control-Allow-Origin" content="*"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><style>body{background-color:#f7f7f7,}</style><title>Katib UI</title><link href="./static/css/2.3e32d45a.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.f25c288f.chunk.js"></script><script src="./static/js/main.bf4e0f37.chunk.js"></script></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ self.__precacheManifest = [
"url": "./static/js/runtime~main.d653cc00.js"
},
{
"revision": "a90e81680f4132e28cad",
"url": "./static/js/main.16d6cce4.chunk.js"
"revision": "c15ec395f085a2064a95",
"url": "./static/js/main.bf4e0f37.chunk.js"
},
{
"revision": "6cfd875360e0c8691af9",
Expand All @@ -16,7 +16,7 @@ self.__precacheManifest = [
"url": "./static/css/2.3e32d45a.chunk.css"
},
{
"revision": "bf2f46e0a6dd0755963ab2564fe2ca78",
"revision": "ba1ed30f2eb9408dab4638479885232a",
"url": "./index.html"
}
];
2 changes: 1 addition & 1 deletion pkg/ui/v1alpha2/frontend/build/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");

importScripts(
"./precache-manifest.6984ac908418813ab69850ccdffb4cd8.js"
"./precache-manifest.688d4f0a6a704321c7606d0910c524a0.js"
);

workbox.clientsClaim();
Expand Down

This file was deleted.

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions pkg/ui/v1alpha2/frontend/src/components/HP/Monitor/HPJobPlot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const HPJobPlot = (props) => {
const classes = useStyles();
let dimensions = [];

if (props.jobData && props.jobData.length !== 0) {
if (props.jobData && props.jobData.length > 1) {
// everything for the third column
let header = props.jobData[0];
let data = props.jobData.slice(1);
Expand All @@ -27,7 +27,7 @@ const HPJobPlot = (props) => {
}
let flag = "number";
let values = [];
for (let j = 0; j < data.length - 1; j++) {
for (let j = 0; j < data.length; j++) {
let number = Number(data[j][i])
if (isNaN(number)) {
flag = "string";
Expand Down Expand Up @@ -67,20 +67,22 @@ const HPJobPlot = (props) => {

return (
<div className={classes.root}>
<Plot
data={
[{
type: 'parcoords',
line: {
color: "red",
},
dimensions: dimensions,
}]}
layout={ {
width: 1000,
height: 600
} }
/>
{props.jobData.length > 1 &&
<Plot
data={
[{
type: 'parcoords',
line: {
color: "red",
},
dimensions: dimensions,
}]}
layout={ {
width: 1000,
height: 600
} }
/>
}
</div>
)
}
Expand Down
58 changes: 30 additions & 28 deletions pkg/ui/v1alpha2/frontend/src/components/HP/Monitor/HPJobTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,42 @@ class HPJobTable extends React.Component {

let header = [];
let data = [];
if (this.props.jobData && this.props.jobData.length !== 0) {
if (this.props.jobData && this.props.jobData.length > 1) {
header = this.props.jobData[0];
data = this.props.jobData.slice(1)
}
return (
<Paper className={classes.root}>
<Table className={classes.table}>
<TableHead>
<TableRow>
{header.map(header => (
<TableCell>{header}</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{data.map((row, id) => (
<TableRow key={id}>
{row.map((element, index) => {
if (index === 0) {
return (
<TableCell className={classes.hover} component="th" scope="row" onClick={this.fetchAndOpenDialog(element)} key={index}>
{element}
</TableCell>
)
} else {
return (
<TableCell align="right">{element}</TableCell>
)
}
})}
{this.props.jobData.length > 1 &&
<Table className={classes.table}>
<TableHead>
<TableRow>
{header.map(header => (
<TableCell>{header}</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</TableHead>
<TableBody>
{data.map((row, id) => (
<TableRow key={id}>
{row.map((element, index) => {
if (index === 0) {
return (
<TableCell className={classes.hover} component="th" scope="row" onClick={this.fetchAndOpenDialog(element)} key={index}>
{element}
</TableCell>
)
} else {
return (
<TableCell align="right">{element}</TableCell>
)
}
})}
</TableRow>
))}
</TableBody>
</Table>
}
</Paper>
);
}
Expand Down