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
21cec9ad
Commit
21cec9ad
authored
Feb 22, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add standard task handler
parent
5253bc59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
msg_resp.go
nm/msg_resp.go
+1
-1
start.go
nm/start.go
+1
-1
task_msg.go
nm/task_msg.go
+17
-5
No files found.
nm/msg_resp.go
View file @
21cec9ad
...
...
@@ -216,7 +216,7 @@ func FetchStandardTaskResp(params ...interface{}) *nodemanagerV1.WorkerMessage {
fetchStandardTaskMsgRes
:=
&
nodemanagerV1
.
WorkerMessage
{
Message
:
&
nodemanagerV1
.
WorkerMessage_FetchStandardTask
{
FetchStandardTask
:
&
nodemanagerV1
.
FetchStandardTask
{
TaskType
:
11
,
TaskType
:
998
,
},
},
}
...
...
nm/start.go
View file @
21cec9ad
...
...
@@ -198,7 +198,7 @@ func handlerStandardTask(nodeManager *models.NodeManagerClient,
noExecAiTaskTime
:=
time
.
Now
()
for
!
taskMsgWorker
.
IsExecAiTask
{
since
:=
time
.
Since
(
noExecAiTaskTime
)
if
since
.
Seconds
()
==
5
{
if
since
.
Seconds
()
==
30
{
msgRespWorker
.
RegisterMsgResp
(
nodeManager
,
worker
,
FetchStandardTaskResp
,
nil
)
taskMsgWorker
.
IsExecStandardTask
=
true
noExecAiTaskTime
=
time
.
Now
()
...
...
nm/task_msg.go
View file @
21cec9ad
...
...
@@ -92,10 +92,7 @@ func (t *TaskHandler) SystemTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
func
(
t
*
TaskHandler
)
ComputeTaskHandler
(
taskMsg
*
nodeManagerV1
.
PushTaskMessage
)
{
defer
t
.
Wg
.
Done
()
if
t
.
IsExecStandardTask
{
//todo: 停止标准任务容器
}
t
.
IsExecAiTask
=
true
t
.
TaskRespBody
[
taskMsg
.
TaskId
]
=
nil
t
.
TaskRespHeader
[
taskMsg
.
TaskId
]
=
nil
t
.
TaskExecTime
[
taskMsg
.
TaskId
]
=
0
...
...
@@ -108,6 +105,19 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
return
}
log
.
Info
(
"received task cmd :"
,
taskCmd
)
if
taskMsg
.
TaskKind
==
baseV1
.
TaskKind_ComputeTask
{
t
.
IsExecAiTask
=
true
if
t
.
IsExecStandardTask
{
//todo: 停止标准任务容器
containers
:=
t
.
DockerOp
.
ListContainer
()
for
_
,
container
:=
range
containers
{
if
container
.
Image
==
taskCmd
.
ImageName
&&
container
.
State
==
"running"
{
t
.
DockerOp
.
StopContainer
(
container
.
ID
)
}
}
t
.
IsExecStandardTask
=
false
}
}
images
,
err
:=
t
.
DockerOp
.
PsImages
()
if
err
!=
nil
{
log
.
Error
(
"Ps images failed:"
,
err
)
...
...
@@ -203,7 +213,9 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
t
.
TaskIsSuccess
[
taskMsg
.
TaskId
]
=
true
t
.
TaskExecTime
[
taskMsg
.
TaskId
]
=
endAfterTaskTime
.
Microseconds
()
}
t
.
IsExecAiTask
=
false
if
taskMsg
.
TaskKind
==
baseV1
.
TaskKind_ComputeTask
{
t
.
IsExecAiTask
=
false
}
log
.
Info
(
"received computeTask--------------------------------"
)
}
...
...
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