Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nodemanager
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
nodemanager
Commits
0252b8a4
Commit
0252b8a4
authored
Apr 17, 2024
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bootup resource map.
parent
605c1eca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
10 deletions
+23
-10
constant.go
config/constant.go
+11
-10
workerManager.go
server/workerManager.go
+1
-0
workerstatu.go
server/workerstatu.go
+11
-0
No files found.
config/constant.go
View file @
0252b8a4
package
config
package
config
const
(
const
(
NODE_MANAGER_SET
=
"node_manager_set"
NODE_MANAGER_SET
=
"node_manager_set"
WORKER_SETS_PREFIX
=
"worker_sets_"
WORKER_SETS_PREFIX
=
"worker_sets_"
WORKER_STATUS_PREFIX
=
"worker_status_"
WORKER_STATUS_PREFIX
=
"worker_status_"
WORKER_NONCE_KEY_PREFIX
=
"worker_nonce_"
WORKER_NONCE_KEY_PREFIX
=
"worker_nonce_"
WORKER_QUEUE_PREFIX
=
"worker_queue_"
WORKER_QUEUE_PREFIX
=
"worker_queue_"
WORKER_DEVICE_INFO_PREFIX
=
"worker_device_info_"
WORKER_DEVICE_INFO_PREFIX
=
"worker_device_info_"
WORKER_DEVICE_STATUS_PREFIX
=
"worker_device_status_"
WORKER_DEVICE_STATUS_PREFIX
=
"worker_device_status_"
WORKER_USAGE_INFO_PREFIX
=
"worker_usage_info_"
WORKER_USAGE_INFO_PREFIX
=
"worker_usage_info_"
WORKER_RESOURCE_INFO_PREFIX
=
"worker_resource_info_"
WORKER_RESOURCE_INFO_PREFIX
=
"worker_resource_info_"
WORKER_LAST_TASK_TM_PREFIX
=
"worker_last_task_tm_"
WORKER_BOOTED_RESOURCE_INFO_PREFIX
=
"worker_boot_resource_info_"
WORKER_LAST_TASK_TM_PREFIX
=
"worker_last_task_tm_"
)
)
server/workerManager.go
View file @
0252b8a4
...
@@ -526,6 +526,7 @@ func (wm *WorkerManager) handleWorkerMsg(worker *Worker) {
...
@@ -526,6 +526,7 @@ func (wm *WorkerManager) handleWorkerMsg(worker *Worker) {
}
}
worker
.
info
.
resourceInfo
=
msg
.
ResourceMap
worker
.
info
.
resourceInfo
=
msg
.
ResourceMap
wm
.
UpdateWorkerResourceInfo
(
worker
,
msg
.
ResourceMap
.
ResourceMap
)
wm
.
UpdateWorkerResourceInfo
(
worker
,
msg
.
ResourceMap
.
ResourceMap
)
wm
.
UpdateWorkerBootedResourceInfo
(
worker
,
msg
.
ResourceMap
.
BootupMap
)
case
*
omanager
.
WorkerMessage_FetchStandardTask
:
case
*
omanager
.
WorkerMessage_FetchStandardTask
:
if
worker
.
info
.
nodeInfo
==
nil
{
if
worker
.
info
.
nodeInfo
==
nil
{
...
...
server/workerstatu.go
View file @
0252b8a4
...
@@ -32,6 +32,12 @@ func (wm *WorkerManager) UpdateWorkerResourceInfo(worker *Worker, resourceInfo [
...
@@ -32,6 +32,12 @@ func (wm *WorkerManager) UpdateWorkerResourceInfo(worker *Worker, resourceInfo [
wm
.
rdb
.
Set
(
context
.
Background
(),
workerResourceInfoKey
(
worker
),
rstr
,
0
)
wm
.
rdb
.
Set
(
context
.
Background
(),
workerResourceInfoKey
(
worker
),
rstr
,
0
)
}
}
func
(
wm
*
WorkerManager
)
UpdateWorkerBootedResourceInfo
(
worker
*
Worker
,
bootedResourceInfo
[]
byte
)
{
rstr
:=
hex
.
EncodeToString
(
bootedResourceInfo
)
log
.
WithField
(
"resourceinfo"
,
rstr
)
.
Infof
(
"update resourceinfo"
)
wm
.
rdb
.
Set
(
context
.
Background
(),
workerBootedResourceInfoKey
(
worker
),
rstr
,
0
)
}
func
(
wm
*
WorkerManager
)
UpdateWorkerNonce
(
worker
*
Worker
,
nonce
int
)
error
{
func
(
wm
*
WorkerManager
)
UpdateWorkerNonce
(
worker
*
Worker
,
nonce
int
)
error
{
return
wm
.
rdb
.
Set
(
context
.
Background
(),
workerNonceKey
(
worker
),
nonce
,
0
)
.
Err
()
return
wm
.
rdb
.
Set
(
context
.
Background
(),
workerNonceKey
(
worker
),
nonce
,
0
)
.
Err
()
}
}
...
@@ -179,6 +185,7 @@ func (wm *WorkerManager) InActiveWorker(worker *Worker) {
...
@@ -179,6 +185,7 @@ func (wm *WorkerManager) InActiveWorker(worker *Worker) {
wm
.
rdb
.
Del
(
context
.
Background
(),
workerUsageInfoKey
(
worker
))
wm
.
rdb
.
Del
(
context
.
Background
(),
workerUsageInfoKey
(
worker
))
wm
.
rdb
.
Del
(
context
.
Background
(),
workerDeviceInfoKey
(
worker
))
wm
.
rdb
.
Del
(
context
.
Background
(),
workerDeviceInfoKey
(
worker
))
wm
.
rdb
.
Del
(
context
.
Background
(),
workerResourceInfoKey
(
worker
))
wm
.
rdb
.
Del
(
context
.
Background
(),
workerResourceInfoKey
(
worker
))
wm
.
rdb
.
Del
(
context
.
Background
(),
workerBootedResourceInfoKey
(
worker
))
if
worker
.
info
.
nodeInfo
!=
nil
{
if
worker
.
info
.
nodeInfo
!=
nil
{
wm
.
rmWorkerFromSets
(
worker
,
worker
.
info
.
nodeInfo
.
BenefitAddress
)
wm
.
rmWorkerFromSets
(
worker
,
worker
.
info
.
nodeInfo
.
BenefitAddress
)
}
}
...
@@ -241,6 +248,10 @@ func workerResourceInfoKey(w *Worker) string {
...
@@ -241,6 +248,10 @@ func workerResourceInfoKey(w *Worker) string {
return
config
.
WORKER_RESOURCE_INFO_PREFIX
+
w
.
workerAddr
return
config
.
WORKER_RESOURCE_INFO_PREFIX
+
w
.
workerAddr
}
}
func
workerBootedResourceInfoKey
(
w
*
Worker
)
string
{
return
config
.
WORKER_BOOTED_RESOURCE_INFO_PREFIX
+
w
.
workerAddr
}
func
workerDeviceInfoKey
(
w
*
Worker
)
string
{
func
workerDeviceInfoKey
(
w
*
Worker
)
string
{
return
config
.
WORKER_DEVICE_INFO_PREFIX
+
w
.
workerAddr
return
config
.
WORKER_DEVICE_INFO_PREFIX
+
w
.
workerAddr
}
}
...
...
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