Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
power-node
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
power-node
Commits
3492d68e
Commit
3492d68e
authored
Mar 05, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change docker server
parent
0bbd7d42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
client.go
operate/client.go
+1
-2
rootcmd_test.go
test/rootcmd_test.go
+17
-0
task_msg_test.go
test/task_msg_test.go
+2
-6
No files found.
operate/client.go
View file @
3492d68e
package
operate
package
operate
import
(
import
(
"example.com/m/conf"
"example.com/m/log"
"example.com/m/log"
"github.com/docker/docker/client"
"github.com/docker/docker/client"
nodemanagerV1
"github.com/odysseus/odysseus-protocol/gen/proto/go/nodemanager/v1"
nodemanagerV1
"github.com/odysseus/odysseus-protocol/gen/proto/go/nodemanager/v1"
...
@@ -27,7 +26,7 @@ func ConnValidatorGrpc(endpoint string) witnessv1.WitnessServiceClient {
...
@@ -27,7 +26,7 @@ func ConnValidatorGrpc(endpoint string) witnessv1.WitnessServiceClient {
}
}
func
GetDockerClient
()
(
*
client
.
Client
,
error
)
{
func
GetDockerClient
()
(
*
client
.
Client
,
error
)
{
dockerClient
,
err
:=
client
.
NewClientWithOpts
(
client
.
WithAPIVersionNegotiation
(),
client
.
WithHost
(
conf
.
GetConfig
()
.
DockerServer
)
)
dockerClient
,
err
:=
client
.
NewClientWithOpts
(
client
.
FromEnv
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
WithField
(
"error"
,
err
)
.
Error
(
"create docker client failed"
)
log
.
WithField
(
"error"
,
err
)
.
Error
(
"create docker client failed"
)
return
nil
,
err
return
nil
,
err
...
...
test/rootcmd_test.go
0 → 100644
View file @
3492d68e
package
test
import
(
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"testing"
)
func
Test_initConfig
(
t
*
testing
.
T
)
{
prvKey
,
_
:=
crypto
.
HexToECDSA
(
"e3b097b0c171e2489973a277b1546392db97e359505cd64b9b52966cb87a0f08"
)
fmt
.
Println
(
"prvKey:"
,
prvKey
)
pubKey
:=
common
.
Bytes2Hex
(
crypto
.
FromECDSAPub
(
&
prvKey
.
PublicKey
))
fmt
.
Println
(
"pubKey:"
,
pubKey
)
address
:=
crypto
.
PubkeyToAddress
(
prvKey
.
PublicKey
)
fmt
.
Println
(
"address:"
,
address
)
}
test/task_msg_test.go
View file @
3492d68e
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
"example.com/m/operate"
"example.com/m/operate"
"fmt"
"fmt"
"github.com/golang/groupcache/lru"
"github.com/golang/groupcache/lru"
basev1
"github.com/odysseus/odysseus-protocol/gen/proto/go/base/v1"
nodeManagerV1
"github.com/odysseus/odysseus-protocol/gen/proto/go/nodemanager/v1"
nodeManagerV1
"github.com/odysseus/odysseus-protocol/gen/proto/go/nodemanager/v1"
"net/http"
"net/http"
"sync"
"sync"
...
@@ -63,9 +62,8 @@ func TestTaskHandler_computeTaskHandler(t1 *testing.T) {
...
@@ -63,9 +62,8 @@ func TestTaskHandler_computeTaskHandler(t1 *testing.T) {
m
:=
&
models
.
TaskCmd
{
m
:=
&
models
.
TaskCmd
{
ImageName
:
"llm-server:latest"
,
ImageName
:
"llm-server:latest"
,
DockerCmd
:
&
models
.
DockerCmd
{
DockerCmd
:
&
models
.
DockerCmd
{
ContainerPort
:
"8888"
,
HostIp
:
"0.0.0.0"
,
HostIp
:
"0.0.0.0"
,
HostPort
:
""
,
HostPort
:
""
,
},
},
ApiUrl
:
"http://192.168.1.120:%d/llm/test/get/sign"
,
ApiUrl
:
"http://192.168.1.120:%d/llm/test/get/sign"
,
}
}
...
@@ -85,8 +83,6 @@ func TestTaskHandler_computeTaskHandler(t1 *testing.T) {
...
@@ -85,8 +83,6 @@ func TestTaskHandler_computeTaskHandler(t1 *testing.T) {
}
}
n
:=
args
{
n
:=
args
{
taskMsg
:
&
nodeManagerV1
.
PushTaskMessage
{
taskMsg
:
&
nodeManagerV1
.
PushTaskMessage
{
TaskUuid
:
"1111"
,
TaskType
:
basev1
.
TaskType_ComputeTask
,
Workload
:
111
,
Workload
:
111
,
TaskCmd
:
string
(
marshal
),
TaskCmd
:
string
(
marshal
),
TaskParam
:
taskParamBytes
,
TaskParam
:
taskParamBytes
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment