ui

package
v0.0.0-...-fecdc3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WidthStep       = 20 * m
	HightStep       = 3 * m
	HightStepHeader = 2 * m
	Margin          = 5 * m
	LineLength      = 5 * m
	SmallMargin     = 4
	VerticalGap     = 4 * m
)
View Source
var JobStatusTpl = template.Must(template.New("job").Funcs(funcMap).Parse(`<!DOCTYPE html>
<html>
  <head>
    <title>Job {{ .Status.Id }}</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  </head>
  <body>
    <div class="container">
      <div class="page-header">
	    <h1>
          <a href="https://github.com/ducminhnguyen/gleam">Gleam</a> <small>{{ .Version }}</small>
	    </h1>
      </div>

      {{ $start := .Status.Driver.StartTime }}

      <div class="row">
        <div class="col-sm-6">
          {{ with .Status.Driver }}
          <h2>{{ .Name }}</h2>
          <table class="table">
            <tbody>
              <tr>
                <th>User</th>
                <td>{{ .Username }}</td>
              </tr>
              <tr>
                <th>Host</th>
                <td>{{ .Hostname }}</td>
              </tr>
              <tr>
                <th>Executable</th>
                <td style="max-width:150px;word-wrap:break-word;">{{ .Executable }}</td>
              </tr>
              <tr>
                <th>Start</th>
                <td>{{ unix .StartTime }}</td>
              </tr>
              {{ with .StopTime }}
              <tr>
                <th>Stop</th>
                <td>{{ unix . }}</td>
              </tr>
              {{ end}}
              <tr>
                <th>Duration</th>
                <td>{{ duration .StopTime $start}}</td>
              </tr>
            </tbody>
          </table>
          {{ end }}
        </div>

        <div class="col-sm-6">
          <h2>System Stats</h2>
          <table class="table table-condensed table-striped">
            <tr>
              <th>Start Time</th>
              <td>{{ .StartTime }}</td>
            </tr>
            <tr>
              <th>Jobs Completed</th>
              <td><a href="/">{{.Logs.Len}}</a></td>
            </tr>
          </table>
        </div>
      </div>

      <div class="row">
        <div class="col-sm-6">
          <p>{{.Svg}}</p>
        </div>
        <div class="col-sm-6">
          {{ with .Status.Steps }}
            <h2>Steps</h2>
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>Step</th>
                  <th>Name</th>
                  <th>Description</th>
                </tr>
              </thead>
              <tbody>
              {{ range $step_index, $step := . }}
                <tr>
                  <td>{{ $step.Id }}</td>
                  <td>{{ $step.Name }}</td>
                  <td>{{ $step.Description }}</td>
                </tr>
              {{ end }}
              </tbody>
            </table>
          {{ end }}
        </div>
      </div>

      {{ with .Status.TaskGroups }}
      <div class="row">
        <h2>Task Group</h2>
        <table class="table table-striped">
          <thead>
            <tr>
              <th>Steps</th>
              <th>Allocation</th>
              <th>Execution</th>
            </tr>
          </thead>
          <tbody>
          {{ range $tg_index, $tg := . }}
            <tr>
              <td>{{ $tg.StepIds }}</td>
              <td>
                {{with $tg.Allocation}}
                    {{.Allocated.MemoryMb}}MB {{.Location.DataCenter}}-{{.Location.Rack}}-{{.Location.Server}}:{{.Location.Port}}
                {{end}}
                <br/>
                
                {{with $tg.Request}}{{with .InstructionSet}}
                {{ range $inst_index, $inst := .Instructions }}
                    {{with .InputShardLocations}}Input: <ul>{{ range . }}<li>{{.Name}}@{{.Host}}:{{.Port}}</li>{{end}}</ul>{{end}}
                    {{with .OutputShardLocations}}Output:<ul>{{ range . }}<li>{{.Name}}@{{.Host}}:{{.Port}}</li>{{end}}{{end}}
                {{end}}
                {{ end }}{{ end }}
              </td>
              <td><ul>{{range .Executions}}
                   <li>
                     {{with .StartTime}} start: {{ duration . $start}} {{end}}
                     {{with .StopTime}} stop: {{ duration . $start}} {{end}}
                     {{with .ExecutionStat}}
                     <ul>
                       {{range .Stats}}
                          <li>{{.StepId}}:{{.TaskId}} {{.InputCounter}}=>{{.OutputCounter}}</li>
                       {{end}}
                     </ul>
                     {{end}}
                   </li>
                  {{end}}</ul></td>
            </tr>
          {{ end }}
          </tbody>
        </table>
      </div>
      {{ end }}

    </div>
  </body>
</html>
`))
View Source
var MasterStatusTpl = template.Must(template.New("master").Funcs(funcMap).Parse(`<!DOCTYPE html>
<html>
  <head>
    <title>Gleam {{ .Version }}</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  </head>
  <body>
    <div class="container">
      <div class="page-header">
	    <h1>
          <a href="https://github.com/ducminhnguyen/gleam">Gleam</a> <small>{{ .Version }}</small>
	    </h1>
      </div>

      <div class="row">
        <div class="col-sm-6">
          <h2>Cluster status</h2>
          <table class="table">
            <tbody>
              <tr>
                <th>Resource</th>
                <td>{{ .Topology.Resource }}</td>
              </tr>
              <tr>
                <th>Allocated</th>
                <td>{{ .Topology.Allocated }}</td>
              </tr>
            </tbody>
          </table>
        </div>

        <div class="col-sm-6">
          <h2>System Stats</h2>
          <table class="table table-condensed table-striped">
            <tr>
              <th>Start Time</th>
              <td>{{ .StartTime }}</td>
            </tr>
            <tr>
              <th>Jobs Completed</th>
              <td><a href="/">{{.Logs.Len}}</a></td>
            </tr>
          </table>
        </div>
      </div>

      <div class="row">
        <h2>Topology</h2>
        <table class="table table-striped">
          <thead>
            <tr>
              <th>Data Center</th>
              <th>Rack</th>
              <th>Server</th>
              <th>Port</th>
              <th>Last Heartbeat</th>
              <th>Resource</th>
              <th>Allocated</th>
            </tr>
          </thead>
          <tbody>
          {{ range $dc_index, $dc := .Topology.DataCenters }}
            {{ range $rack_index, $rack := $dc.Racks }}
              {{ range $agent_index, $agent := $rack.Agents }}
            <tr>
              <td><code>{{ $dc.Name }}</code></td>
              <td>{{ $rack.Name }}</td>
              <td>{{ $agent.Location.Server }}</td>
              <td>{{ $agent.Location.Port }}</td>
              <td>{{ $agent.LastHeartBeat }}</td>
              <td>{{ $agent.Resource }}</td>
              <td>{{ $agent.Allocated }}</td>
            </tr>
              {{ end }}
            {{ end }}
          {{ end }}
          </tbody>
        </table>
      </div>

      <div class="row">
        <h2>Jobs</h2>
        <table class="table table-striped">
          <thead>
            <tr>
              <th>Id</th>
              <th>Name</th>
              <th>Driver</th>
              <th>User</th>
              <th>Host</th>
              <th>Duration</th>
            </tr>
          </thead>
          <tbody>
            {{ range $idx, $stat := $.Stats }}
            <tr>
              <td><a href="/job/{{$stat.Id}}">{{ $stat.Id }}</a></td>
              <td>{{ $stat.Driver.Name }}</td>
              <td>{{ $stat.Driver.Executable }}</td>
              <td>{{ $stat.Driver.Username }}</td>
              <td>{{ $stat.Driver.Hostname }}</td>
              <td>{{ duration $stat.Driver.StopTime $stat.Driver.StartTime }}</td>
            </tr>
            {{ end }}
          </tbody>
        </table>
      </div>

    </div>
  </body>
</html>
`))

Functions

func Duration

func Duration(stop, start int64) string

func GenSvg

func GenSvg(status *pb.FlowExecutionStatus) string

func Unix

func Unix(t int64) time.Time

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL