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

feat: add node scheduling control #366

Merged
merged 7 commits into from
Jan 16, 2025
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
8 changes: 6 additions & 2 deletions api/api_curio.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"

ltypes "github.com/filecoin-project/curio/api/types"
storiface "github.com/filecoin-project/curio/lib/storiface"

"github.com/filecoin-project/lotus/api"
Expand All @@ -19,8 +20,11 @@ type Curio interface {
// MethodGroup: Curio
//The common method group contains administration methods

Version(context.Context) ([]int, error) //perm:admin
Shutdown(context.Context) error //perm:admin
Version(context.Context) ([]int, error) //perm:admin
Shutdown(context.Context) error //perm:admin
Cordon(context.Context) error //perm:admin
Uncordon(context.Context) error //perm:admin
Info(ctx context.Context) (*ltypes.NodeInfo, error) //perm:read

// MethodGroup: Deal
//The deal method group contains method for adding deals to sector
Expand Down
40 changes: 40 additions & 0 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions api/types/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package types

import "time"

type NodeInfo struct {
ID int
CPU int
RAM int64
GPU float64
HostPort string
LastContact time.Time
Unschedulable bool

Name string
StartupTime time.Time
Tasks string
Layers string
Miners string
}
156 changes: 143 additions & 13 deletions build/openrpc/curio.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,114 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L317"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L327"
}
},
{
"name": "Filecoin.Cordon",
"description": "```go\nfunc (s *CurioStruct) Cordon(p0 context.Context) error {\n\tif s.Internal.Cordon == nil {\n\t\treturn ErrNotSupported\n\t}\n\treturn s.Internal.Cordon(p0)\n}\n```",
"summary": "",
"paramStructure": "by-position",
"params": [],
"result": {
"name": "Null",
"description": "Null",
"schema": {
"type": [
"null"
]
},
"required": true,
"deprecated": false
},
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L338"
}
},
{
"name": "Filecoin.Info",
"description": "```go\nfunc (s *CurioStruct) Info(p0 context.Context) (*ltypes.NodeInfo, error) {\n\tif s.Internal.Info == nil {\n\t\treturn nil, ErrNotSupported\n\t}\n\treturn s.Internal.Info(p0)\n}\n```",
"summary": "",
"paramStructure": "by-position",
"params": [],
"result": {
"name": "*ltypes.NodeInfo",
"description": "*ltypes.NodeInfo",
"summary": "",
"schema": {
"examples": [
{
"ID": 123,
"CPU": 123,
"RAM": 9,
"GPU": 1,
"HostPort": "string value",
"LastContact": "0001-01-01T00:00:00Z",
"Unschedulable": true,
"Name": "string value",
"StartupTime": "0001-01-01T00:00:00Z",
"Tasks": "string value",
"Layers": "string value",
"Miners": "string value"
}
],
"additionalProperties": false,
"properties": {
"CPU": {
"title": "number",
"type": "number"
},
"GPU": {
"type": "number"
},
"HostPort": {
"type": "string"
},
"ID": {
"title": "number",
"type": "number"
},
"LastContact": {
"format": "date-time",
"type": "string"
},
"Layers": {
"type": "string"
},
"Miners": {
"type": "string"
},
"Name": {
"type": "string"
},
"RAM": {
"title": "number",
"type": "number"
},
"StartupTime": {
"format": "date-time",
"type": "string"
},
"Tasks": {
"type": "string"
},
"Unschedulable": {
"type": "boolean"
}
},
"type": [
"object"
]
},
"required": true,
"deprecated": false
},
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L349"
}
},
{
Expand Down Expand Up @@ -348,7 +455,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L328"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L360"
}
},
{
Expand Down Expand Up @@ -402,7 +509,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L339"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L371"
}
},
{
Expand All @@ -425,7 +532,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L350"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L382"
}
},
{
Expand Down Expand Up @@ -464,7 +571,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L361"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L393"
}
},
{
Expand Down Expand Up @@ -503,7 +610,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L372"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L404"
}
},
{
Expand Down Expand Up @@ -697,7 +804,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L383"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L415"
}
},
{
Expand Down Expand Up @@ -829,7 +936,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L394"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L426"
}
},
{
Expand Down Expand Up @@ -963,7 +1070,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L405"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L437"
}
},
{
Expand Down Expand Up @@ -1017,7 +1124,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L416"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L448"
}
},
{
Expand Down Expand Up @@ -1051,7 +1158,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L427"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L459"
}
},
{
Expand Down Expand Up @@ -1128,7 +1235,30 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L438"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L470"
}
},
{
"name": "Filecoin.Uncordon",
"description": "```go\nfunc (s *CurioStruct) Uncordon(p0 context.Context) error {\n\tif s.Internal.Uncordon == nil {\n\t\treturn ErrNotSupported\n\t}\n\treturn s.Internal.Uncordon(p0)\n}\n```",
"summary": "",
"paramStructure": "by-position",
"params": [],
"result": {
"name": "Null",
"description": "Null",
"schema": {
"type": [
"null"
]
},
"required": true,
"deprecated": false
},
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L481"
}
},
{
Expand Down Expand Up @@ -1166,7 +1296,7 @@
"deprecated": false,
"externalDocs": {
"description": "Github remote link",
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L449"
"url": "https://github.com/filecoin-project/curio/blob/master/api/proxy_gen.go#L492"
}
}
]
Expand Down
3 changes: 3 additions & 0 deletions cmd/curio/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,13 @@ var cliCmd = &cli.Command{
return nil
},
Subcommands: []*cli.Command{
infoCmd,
storageCmd,
logCmd,
waitApiCmd,
stopCmd,
cordonCmd,
uncordonCmd,
},
}

Expand Down
Loading
Loading