Skip to content

Commit

Permalink
fix: curio: node UI & darwin gpu count (#11950)
Browse files Browse the repository at this point in the history
* fix: curio: Update pgx imports, fix db_storage alloc

* feat: curioweb: Improve task_history indexes (#11911)

* 1

* relatable

* add and delete layer

* chore: curio: merge master (#11956)

* Fixing dead links (#11907)

* ci: ci: create gh workflow that updates sorted pr checks (#11861)

* ci: create gh workflow that updates sorted pr checks

* ci: use grouped_by_result template for pr checks sticky comment

* chore: apply pr review suggestion

* Avoid cfg lookup on chain remove since unenabled splitstore delete is noop anyway (#11916)

Co-authored-by: zenground0 <[email protected]>

* Fix mismatched method names in comments (#11913)

Signed-off-by: forcedebug <[email protected]>

* release: v1.26.3 (#11908) (#11915) (#11922)

* deps: update dependencies to address migration memory bloat

to address memory concerns during a heavy migration

Ref: filecoin-project/go-state-types#260
Ref: whyrusleeping/cbor-gen#96
Ref: filecoin-project/go-amt-ipld#90

* release: prep v1.26.3 patch

Prep v1.26.3 patch release:
- Update changelog, version and make gen + make docsgen-cli

* deps: update cbor-gen to tagged version

deps: update cbor-gen to tagged version

* deps: update go-state-types to tagged version

deps: update go-state-types to tagged version v0.13.2

* chore: deps: update go-state-types to v0.13.3

Fixes a panic when we have fewer than 1k proposals.

---------

Co-authored-by: Phi-rjan <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>

* Refactor `LookupID*` APIs in `StateManager` and `StateTree`

The naming of `LookupID` can cause confusion when resolving actor IDs vs
 ID addresses. To avoid this:

* Refactor `StateTree` `LookupID` to `LookupIDAddress`, because it
returns ID address.
* Refactor `StateManager` `LookupID` to
`LookupIDAddress` because it also returns ID address via a chain call to
`StateTree`.
* Introduce a new API `StateManager` dedicated to resolving address to
actor ID, called `LookupID` which returns `abi.ActorID`.

For context, see:
 * filecoin-project/lotus#11723 (comment)

* Add v13 support to invariants-checker (#11931)

Add v13 support to invariants-checker

* chore: docs: nv-skeleton documentation (#11065)

* nv-skeleton documentation

Add a tutorial for how one can create a nv-skeleton in Lotus

* Add footnote for `Add migration` step

Add footnote for `Add migration` step

* Indent migration-code

Indent migration-code to make it show properly as a footnote.

* Add ref-fvm and filecoin-ffi checklist

Add ref-fvm and filecoin-ffi checklist

* Add Filecoin-FFI steps

Add Filecoin-FFI steps

* Add step to params_butterfly.go

Add step to params_butterfly.go

* Fix typo

Fix typo

* Add links to reference PRs

Add links to reference PRs

* Update ref-fvm list

Update ref-fvm list

* feat: curio: add StorageInit api (#11918)

* feat: add StorageInit api

* remove unused variables

* fix gen check

* feat: curio: simpler reservation release logic (#11900)

* simpler release logic

* oops, plus simpler

* simpler

* fix NewLine (#11893)

* fix(events): check for sync-in-progress (#11932)

* feat(events): adjust indexes in event index db to match query patterns

Introduces a v4 migration that just adjusts indexes.

Copies some improvements from filecoin-project/lotus#11723

Closes: filecoin-project/lotus#11909

* fix(pipeline): should return if error occurred when get network version (#11902)

* fix(events): correct log msg for v4 events index db migration

* chore: remove duplicate words in strings and comments

* fix(events): register events index db migration v4

* fix: curio seal: Failed commit retry strategy (#11870)

* ffi: improved-error-handling

* curio seal: Failed commit retry strategy

* use master ffi

* mod tidy

* fix: curio: Update pgx imports, fix db_storage alloc

* feat: curioweb: Improve task_history indexes (#11911)

* mod tidy

* Event index should be unique for tipsets (#11952)

* event index should be unique for tipsets

* fix formatting

* migrate to version 5

* chore: bump build version in master (#11946)

* Bump version

Bump version in master branch in preperation for cutting v1.27.0-rc1

* chore: bump build-version

chore: bump build-version

* feat: curioweb: Show piece info on the sector page (#11955)

* curio: feat: break trees task into TreeD(prefetch) and TreeRC (#11895)

* break trees task

* fix TreeD reservation

* fix nil pointer err

* apply suggestions

* fix allocate file types

* fix dbIndex inserts

* set resource, move release func

* refactor func(), update memory

* remove extra release

---------

Signed-off-by: forcedebug <[email protected]>
Co-authored-by: parthshah1 <[email protected]>
Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: ZenGround0 <[email protected]>
Co-authored-by: zenground0 <[email protected]>
Co-authored-by: forcedebug <[email protected]>
Co-authored-by: Jiaying Wang <[email protected]>
Co-authored-by: Phi-rjan <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>
Co-authored-by: Masih H. Derkani <[email protected]>
Co-authored-by: Lee <[email protected]>
Co-authored-by: Andrew Jackson (Ajax) <[email protected]>
Co-authored-by: beck <[email protected]>
Co-authored-by: 0x5459 <[email protected]>
Co-authored-by: Łukasz Magiera <[email protected]>
Co-authored-by: Łukasz Magiera <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>

* linter oops

* gen cleanup

* fix

* named returns are confusing

---------

Signed-off-by: forcedebug <[email protected]>
Co-authored-by: Łukasz Magiera <[email protected]>
Co-authored-by: Łukasz Magiera <[email protected]>
Co-authored-by: LexLuthr <[email protected]>
Co-authored-by: parthshah1 <[email protected]>
Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: ZenGround0 <[email protected]>
Co-authored-by: zenground0 <[email protected]>
Co-authored-by: forcedebug <[email protected]>
Co-authored-by: Jiaying Wang <[email protected]>
Co-authored-by: Phi-rjan <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>
Co-authored-by: Masih H. Derkani <[email protected]>
Co-authored-by: Lee <[email protected]>
Co-authored-by: beck <[email protected]>
Co-authored-by: 0x5459 <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
  • Loading branch information
18 people committed May 4, 2024
1 parent f9c3cf5 commit 89429b9
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 20 deletions.
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.
}

0 comments on commit 89429b9

Please sign in to comment.