Skip to content

Commit 96ff302

Browse files
authored
Merge pull request #69 from WeBankFinTech/dev-0.3.2
Prophecis v0.3.2 release
2 parents 6e6f1fa + 2b5d3e1 commit 96ff302

File tree

437 files changed

+60512
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

437 files changed

+60512
-746
lines changed

cc/pkg/service/authService.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ func CheckNamespaceUser(namespace string, admin string, username string) error {
352352
func CheckUserGetNamespace(admin string, username string) (*models.UserNoteBook, error) {
353353
db := datasource.GetDB()
354354
var userNotebook *models.UserNoteBook
355-
if admin == username {
356-
userNotebook = &models.UserNoteBook{
357-
Role: "SELF",
358-
}
359-
return userNotebook, nil
360-
}
355+
//if admin == username {
356+
// userNotebook = &models.UserNoteBook{
357+
// Role: "SELF",
358+
// }
359+
// return userNotebook, nil
360+
//}
361361

362362
saByAdmin, err := repo.GetSAByName(username)
363363
if err != nil {

di/commons/errors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package commons
2+
3+
import "errors"
4+
5+
var (
6+
// ErrRecordNotFound record not found error
7+
PermissionDeniedError = errors.New("permission denied")
8+
9+
)

di/commons/kubectl/configmap.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2018 The Kubeflow Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package kubectl
16+
17+
import (
18+
"fmt"
19+
"strings"
20+
21+
log "github.com/sirupsen/logrus"
22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
"k8s.io/client-go/kubernetes"
24+
"webank/DI/commons/types"
25+
)
26+
27+
const JOB_CONFIG_LABEL = "createdBy=arena"
28+
29+
/**
30+
*
31+
* list configMaps by using namespace
32+
**/
33+
func ListAppConfigMaps(clientset *kubernetes.Clientset, namespace string, trainingTypes []string) (jobs []types.TrainingJobInfo, err error) {
34+
35+
jobs = []types.TrainingJobInfo{}
36+
cmList, err := clientset.CoreV1().ConfigMaps(namespace).List(metav1.ListOptions{LabelSelector: JOB_CONFIG_LABEL})
37+
if err != nil {
38+
return nil, err
39+
}
40+
41+
log.Debugf("The cmList is %v", cmList.Items)
42+
43+
for _, cm := range cmList.Items {
44+
found := false
45+
46+
job := types.TrainingJobInfo{}
47+
48+
innerLoop:
49+
for _, trainingType := range trainingTypes {
50+
if strings.HasSuffix(cm.Name, fmt.Sprintf("-%s", trainingType)) {
51+
found = true
52+
job.Name = strings.TrimSuffix(cm.Name, fmt.Sprintf("-%s", trainingType))
53+
job.Type = trainingType
54+
job.Namespace = cm.Namespace
55+
break innerLoop
56+
}
57+
}
58+
59+
if found {
60+
jobs = append(jobs, job)
61+
} else {
62+
log.Debugf("drop %s in training configmap", job)
63+
}
64+
65+
}
66+
67+
log.Debugf("the job training configmap: %q", jobs)
68+
69+
return jobs, nil
70+
}

0 commit comments

Comments
 (0)