Skip to content

Commit eda7af8

Browse files
committed
chore: some tiny error
1 parent ac7feac commit eda7af8

File tree

11 files changed

+169
-4
lines changed

11 files changed

+169
-4
lines changed

vermeer/apps/master/bl/scheduler_bl.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package bl
1919

2020
import (
2121
"errors"
22+
"fmt"
2223
"strconv"
2324
"time"
2425
"vermeer/apps/common"
@@ -201,7 +202,9 @@ func (s *ScheduleBl) tryScheduleInner(softSchedule bool, noLock ...bool) error {
201202
case s.startChan <- task:
202203
logrus.Infof("task '%d' sent to start channel", task.ID)
203204
default:
204-
logrus.Warnf("start channel is full, task '%d' could not be sent", task.ID)
205+
errMsg := fmt.Sprintf("start channel is full, cannot schedule task %d", task.ID)
206+
logrus.Errorf(errMsg)
207+
taskMgr.SetError(task, errMsg)
205208
}
206209
}
207210

@@ -368,7 +371,7 @@ func (s *ScheduleBl) ChangeWorkerStatus(workerName string, status schedules.Work
368371
func (s *ScheduleBl) waitingStartedTask() {
369372
for taskInfo := range s.startChan {
370373
if taskInfo == nil {
371-
logrus.Warnf("recieved a nil task from startChan")
374+
logrus.Warnf("received a nil task from startChan")
372375
continue
373376
}
374377

vermeer/apps/master/bl/task_bl.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package bl
2020
import (
2121
"errors"
2222
"fmt"
23+
"math"
2324
"sort"
2425
"strconv"
2526
"strings"
@@ -74,6 +75,9 @@ func (tb *TaskBl) CreateTaskInfo(
7475
if p < 0 {
7576
return nil, fmt.Errorf("priority should be non-negative")
7677
}
78+
if p > math.MaxInt32 {
79+
return nil, fmt.Errorf("priority exceeds maximum value: %d", math.MaxInt32)
80+
}
7781
taskInfo.Priority = int32(p)
7882
} else {
7983
logrus.Warnf("priority convert to int32 error:%v", err)
@@ -85,7 +89,7 @@ func (tb *TaskBl) CreateTaskInfo(
8589
for _, preorder := range preorderList {
8690
if pid, err := strconv.ParseInt(preorder, 10, 32); err == nil {
8791
if taskMgr.GetTaskByID(int32(pid)) == nil {
88-
return nil, fmt.Errorf("preorder task id %d not exists", pid)
92+
return nil, fmt.Errorf("preorder task with ID %d does not exist", pid)
8993
}
9094
taskInfo.Preorders = append(taskInfo.Preorders, int32(pid))
9195
} else {

vermeer/apps/master/schedules/scheduler_algorithm_manager.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package schedules
219

320
import (

vermeer/apps/master/schedules/scheduler_cron_manager.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package schedules
219

320
import (

vermeer/apps/master/schedules/scheduler_resource_manager.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package schedules
219

320
import (

vermeer/apps/master/schedules/scheduler_task_manager.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package schedules
219

320
import (
421
"errors"
22+
"vermeer/apps/common"
523
"vermeer/apps/structure"
624

725
"github.com/sirupsen/logrus"
@@ -86,6 +104,10 @@ func (t *SchedulerTaskManager) RefreshTaskToWorkerGroupMap() {
86104
* @Return error
87105
*/
88106
func (t *SchedulerTaskManager) AddTaskStartSequence(taskID int32) error {
107+
if common.GetConfig("debug_mode").(string) != "debug" {
108+
logrus.Warn("TaskStartSequence called but debug features are disabled")
109+
return nil
110+
}
89111
if _, exists := t.allTaskMap[taskID]; !exists {
90112
return errors.New("task not found")
91113
}
@@ -202,7 +224,7 @@ func (t *SchedulerTaskManager) GetAllTasksNotComplete() []*structure.TaskInfo {
202224
return tasks
203225
}
204226

205-
func (t *SchedulerTaskManager) GetAllTasksWaitng() []*structure.TaskInfo {
227+
func (t *SchedulerTaskManager) GetAllTasksWaiting() []*structure.TaskInfo {
206228
tasks := make([]*structure.TaskInfo, 0, len(t.allTaskMap))
207229
for _, task := range t.GetAllTasksNotComplete() {
208230
if task.State == structure.TaskStateWaiting {

vermeer/docker-compose.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
118
version: '3.8'
219

320
services:

vermeer/test/scheduler/batch.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package scheduler
219

320
import (

vermeer/test/scheduler/priority.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package scheduler
219

320
import (

vermeer/test/scheduler/routine.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with this
4+
work for additional information regarding copyright ownership. The ASF
5+
licenses this file to You under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations
15+
under the License.
16+
*/
17+
118
package scheduler
219

320
import (

0 commit comments

Comments
 (0)