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

Fix/node UI gpu #11958

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
06761db
Fixing dead links (#11907)
parthshah1 Apr 20, 2024
70e0767
ci: ci: create gh workflow that updates sorted pr checks (#11861)
galargh Apr 22, 2024
95b6483
Avoid cfg lookup on chain remove since unenabled splitstore delete is…
ZenGround0 Apr 23, 2024
772f6a3
Fix mismatched method names in comments (#11913)
forcedebug Apr 23, 2024
d23ea76
release: v1.26.3 (#11908) (#11915) (#11922)
jennijuju Apr 24, 2024
f907354
Refactor `LookupID*` APIs in `StateManager` and `StateTree`
masih Apr 23, 2024
65edab4
Add v13 support to invariants-checker (#11931)
rjan90 Apr 25, 2024
ec6d3e1
chore: docs: nv-skeleton documentation (#11065)
rjan90 Apr 25, 2024
0f7c74e
feat: curio: add StorageInit api (#11918)
strahe Apr 26, 2024
5e1d8f6
feat: curio: simpler reservation release logic (#11900)
snadrus Apr 26, 2024
0a28ce4
fix NewLine (#11893)
beck-8 Apr 27, 2024
ae2cc67
fix(events): check for sync-in-progress (#11932)
rvagg Apr 29, 2024
10877d2
feat(events): adjust indexes in event index db to match query patterns
rvagg Apr 26, 2024
15f5f47
fix(pipeline): should return if error occurred when get network versi…
0x5459 Apr 29, 2024
aa76a45
fix(events): correct log msg for v4 events index db migration
rvagg Apr 29, 2024
cee77aa
chore: remove duplicate words in strings and comments
rvagg Apr 30, 2024
46992f0
fix(events): register events index db migration v4
rvagg Apr 30, 2024
914a65c
fix: curio seal: Failed commit retry strategy (#11870)
magik6k Apr 30, 2024
1b6bffd
fix: curio: Update pgx imports, fix db_storage alloc
magik6k Apr 20, 2024
c2dd674
feat: curioweb: Improve task_history indexes (#11911)
magik6k Apr 24, 2024
10f7b6e
mod tidy
magik6k Apr 30, 2024
461bb5b
1
snadrus Apr 30, 2024
f4763e3
relatable
snadrus Apr 30, 2024
5b11bd6
add and delete layer
snadrus Apr 30, 2024
6bbe090
Event index should be unique for tipsets (#11952)
aarshkshah1992 May 1, 2024
7ced766
Merge branch 'master' into fix/node-ui-gpu
snadrus May 1, 2024
ed9b1b1
chore: bump build version in master (#11946)
rjan90 May 2, 2024
ecc82d4
feat: curioweb: Show piece info on the sector page (#11955)
magik6k May 2, 2024
00edad4
curio: feat: break trees task into TreeD(prefetch) and TreeRC (#11895)
LexLuthr May 2, 2024
a0a3eec
linter oops
snadrus May 2, 2024
36cc225
Merge branch 'release/curio-beta' into fix/node-ui-gpu
snadrus May 2, 2024
8f9e37c
gen cleanup
snadrus May 2, 2024
d875e98
Merge branch 'master' into fix/node-ui-gpu
snadrus May 2, 2024
b79a1e0
fix
snadrus May 2, 2024
5a77225
named returns are confusing
snadrus May 2, 2024
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
23 changes: 23 additions & 0 deletions curiosrc/web/api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import (
"github.com/BurntSushi/toml"
"github.com/gorilla/mux"
"github.com/invopop/jsonschema"
logging "github.com/ipfs/go-log/v2"

"github.com/filecoin-project/lotus/cmd/curio/deps"
"github.com/filecoin-project/lotus/curiosrc/web/api/apihelper"
"github.com/filecoin-project/lotus/node/config"
)

var log = logging.Logger("curio/web/config")

type cfg struct {
*deps.Deps
}
Expand All @@ -30,9 +33,29 @@ func Routes(r *mux.Router, deps *deps.Deps) {
// At edit.html:
r.Methods("GET").Path("/schema").HandlerFunc(getSch)
r.Methods("GET").Path("/layers/{layer}").HandlerFunc(c.getLayer)
r.Methods("POST").Path("/addlayer").HandlerFunc(c.addLayer)
r.Methods("POST").Path("/layers/{layer}").HandlerFunc(c.setLayer)
r.Methods("GET").Path("/default").HandlerFunc(c.def)
}

func (c *cfg) addLayer(w http.ResponseWriter, r *http.Request) {
var layer struct {
Name string
}
apihelper.OrHTTPFail(w, json.NewDecoder(r.Body).Decode(&layer))
ct, err := c.DB.Exec(context.Background(), `INSERT INTO harmony_config (title, config) VALUES ($1, $2)`, layer.Name, "")
apihelper.OrHTTPFail(w, err)
if ct != 1 {
w.WriteHeader(http.StatusConflict)
_, err = w.Write([]byte("Layer already exists"))
if err != nil {
log.Errorf("Failed to write response: %s", err)
}
return
}
w.WriteHeader(200)
}

func getSch(w http.ResponseWriter, r *http.Request) {
ref := jsonschema.Reflector{
Mapper: func(i reflect.Type) *jsonschema.Schema {
Expand Down
17 changes: 11 additions & 6 deletions curiosrc/web/hapi/simpleinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"text/template"
"time"

"github.com/dustin/go-humanize"
"github.com/gorilla/mux"
"github.com/samber/lo"
"golang.org/x/xerrors"
Expand Down Expand Up @@ -517,7 +518,10 @@ type machineSummary struct {
ID int64
SinceContact string

RecentTasks []*machineRecentTask
RecentTasks []*machineRecentTask
Cpu int
RamHumanized string
Gpu int
}

type taskSummary struct {
Expand Down Expand Up @@ -580,7 +584,7 @@ func (a *app) clusterMachineSummary(ctx context.Context) ([]machineSummary, erro
}

// Then machine summary
rows, err := a.db.Query(ctx, "SELECT id, host_and_port, last_contact FROM harmony_machines order by host_and_port asc")
rows, err := a.db.Query(ctx, "SELECT id, host_and_port, CURRENT_TIMESTAMP - last_contact AS last_contact, cpu, ram, gpu FROM harmony_machines order by host_and_port asc")
if err != nil {
return nil, err // Handle error
}
Expand All @@ -589,13 +593,14 @@ func (a *app) clusterMachineSummary(ctx context.Context) ([]machineSummary, erro
var summaries []machineSummary
for rows.Next() {
var m machineSummary
var lastContact time.Time
var lastContact time.Duration
var ram int64

if err := rows.Scan(&m.ID, &m.Address, &lastContact); err != nil {
if err := rows.Scan(&m.ID, &m.Address, &lastContact, &m.Cpu, &ram, &m.Gpu); err != nil {
return nil, err // Handle error
}

m.SinceContact = time.Since(lastContact).Round(time.Second).String()
m.SinceContact = lastContact.Round(time.Second).String()
m.RamHumanized = humanize.Bytes(uint64(ram))

// Add recent tasks
if ts, ok := taskSummaries[m.Address]; ok {
Expand Down
3 changes: 3 additions & 0 deletions curiosrc/web/hapi/web/cluster_machines.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<tr>
<td><a href="/hapi/node/{{.ID}}">{{.Address}}</a></td>
<td>{{.ID}}</td>
<td>{{.Cpu}}</td>
<td>{{.RamHumanized}}</td>
<td>{{.Gpu}}</td>
<td>{{.SinceContact}}</td>
{{range .RecentTasks}}
<td>{{.TaskName}}:{{.Success}}{{if ne 0 .Fail}}(<i class="{{if eq 0 .Success}}error{{else}}warning{{end}}">{{.Fail}}</i>){{end}}</td>
Expand Down
8 changes: 4 additions & 4 deletions curiosrc/web/hapi/web/node_info.gohtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{define "node_info"}}
<h2>Info</h2>
<table>
<table class="table table-dark">
<tr>
<td>Host</td>
<td>ID</td>
Expand All @@ -22,7 +22,7 @@
</table>
<hr>
<h2>Storage</h2>
<table>
<table class="table table-dark">
<tr>
<td>ID</td>
<td>Type</td>
Expand Down Expand Up @@ -56,7 +56,7 @@
<hr>
<h2>Tasks</h2>
<h3>Running</h3>
<table>
<table class="table table-dark">
<tr>
<td>ID</td>
<td>Task</td>
Expand All @@ -73,7 +73,7 @@
{{end}}
</table>
<h3>Recently Finished</h3>
<table>
<table class="table table-dark">
<tr>
<td>ID</td>
<td>Task</td>
Expand Down
5 changes: 3 additions & 2 deletions curiosrc/web/hapi/web/root.gohtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{define "root"}}
<!DOCTYPE html>
<html>
<head>
<title>{{.PageTitle}}</title>
<script src="https://unpkg.com/[email protected]" integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" crossorigin="anonymous"></script>
<script type="module" src="chain-connectivity.mjs"></script>
<link rel="stylesheet" href="/main.css">
<script type="module" src="/chain-connectivity.mjs"></script>
<link rel="stylesheet" href="/ux/main.css">
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/build/web/hack-subset.css'>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<script type="module" src="/ux/curio-ux.mjs"></script>
Expand Down
28 changes: 28 additions & 0 deletions curiosrc/web/static/config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
this.loadData();
this.message = this.readCookie('message');
this.eraseCookie('message');
this.addName = '';
}
static get styles() {
return [css`
Expand All @@ -46,6 +47,13 @@
</tr>
`)}
</table>
<input autofocus type="text" id="layername" placeholder="Layer Name" @change=${this.updateName}>
<button class="button" @click=${this.addLayer}>Add Layer</button>
<hr>
<span>
To delete a layer, use ysqlsh to issue the following command:<br>
<code lang=sql>DELETE FROM curio.harmony_config WHERE title = 'my_layer_name';</code>
</span>
`;
}
loadData() {
Expand Down Expand Up @@ -77,6 +85,26 @@
eraseCookie(name) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
}

updateName(e) {
this.addName = e.target.value;
}
addLayer() {
// get a name
var v = this.addName;
if (v === '') {
alert('Error: Layer name cannot be empty');
return;
}

axios.post('/api/config/addlayer', { name: v })
.then(response => {
window.location.href = '/config/edit.html?layer=' + v;
})
.catch(error => {
alert('Error adding layer:', error);
});
}
});
</script>
<curio-ux>
Expand Down
17 changes: 10 additions & 7 deletions curiosrc/web/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<curio-ux>
<div class="page">
<div class="row">
<div class="col-md-auto" style="width: 50%">
<div class="col-md-auto" style="max-width: 1000px">
<div class="info-block">
<h2>Chain Connectivity</h2>
<chain-connectivity></chain-connectivity>
Expand All @@ -71,14 +71,17 @@ <h2>Chain Connectivity</h2>
</div>

<div class="row">
<div class="col-md-auto" style="width: 50%">
<div class="col-md-auto" style="max-width: 1000px">
<div class="info-block">
<h2>Cluster Machines</h2>
<table class="table table-dark">
<thead>
<tr>
<th>Host</th>
<th>ID</th>
<th>CPUs</th>
<th>RAM</th>
<th>GPUs</th>
<th>Last Contact</th>
<th>Tasks (24h)</th>
</tr>
Expand All @@ -93,7 +96,7 @@ <h2>Cluster Machines</h2>
</div>

<div class="row">
<div class="col-md-auto" style="width: 50%">
<div class="col-md-auto" style="max-width: 1000px">
<div class="info-block">
<h2><a href="/pipeline_porep.html">PoRep Pipeline</a></h2>
<table class="table table-dark">
Expand All @@ -120,7 +123,7 @@ <h2><a href="/pipeline_porep.html">PoRep Pipeline</a></h2>
</div>

<div class="row">
<div class="col-md-auto" style="width: 50%">
<div class="col-md-auto" style="max-width: 1000px">
<div class="info-block">
<h2>Actor Summary</h2>
<table class="table table-dark">
Expand All @@ -133,7 +136,7 @@ <h2>Actor Summary</h2>
<th>Balance</th>
<th>Available</th>
<th>Worker</th>
<th>Wins</th>
<th style="min-width: 100px">Wins</th>
</tr>
</thead>
<tbody hx-get="/hapi/simpleinfo/actorsummary" hx-trigger="load,every 5s">
Expand All @@ -147,7 +150,7 @@ <h2>Actor Summary</h2>


<div class="row">
<div class="col-md-auto" style="width: 50%">
<div class="col-md-auto" style="max-width: 1000px">
<div class="info-block">
<h2>Recently Finished Tasks</h2>
<table class="table table-dark">
Expand All @@ -174,7 +177,7 @@ <h2>Recently Finished Tasks</h2>
</div>

<div class="row">
<div class="col-md-auto" style="width: 50%">
<div class="col-md-auto" style="max-width: 1000px">
<div class="info-block">
<h2>Cluster Tasks</h2>
<table class="table table-dark">
Expand Down
2 changes: 1 addition & 1 deletion lib/harmony/resources/getGPU_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
package resources

func getGPUDevices() float64 {
return 10000.0 // unserious value intended for non-production use.
return 1.0 // likely-true value intended for non-production use.
}
6 changes: 3 additions & 3 deletions storage/paths/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,9 @@ func (st *Local) reportStorage(ctx context.Context) {
}
}

func (st *Local) Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int, minFreePercentage float64) (userRelease func(), err error) {
var ssize abi.SectorSize
ssize, err = sid.ProofType.SectorSize()
func (st *Local) Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType,
storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int, minFreePercentage float64) (func(), error) {
ssize, err := sid.ProofType.SectorSize()
if err != nil {
return nil, err
}
Expand Down