Skip to content

Commit

Permalink
v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yangjie727 committed Aug 5, 2024
1 parent ac17639 commit 0fa0d67
Show file tree
Hide file tree
Showing 21 changed files with 3,895 additions and 4,199 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARCH ?= amd64

protos:
buf generate --template buf.gen.yaml https://github.com/PKUHPC/scow-scheduler-adapter-interface.git#subdir=protos,tag=v1.5.0
buf generate --template buf.gen.yaml https://github.com/PKUHPC/scow-scheduler-adapter-interface.git#subdir=protos,tag=feat-get-nodes-info

run:
go run *.go
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# slurm adapter for SCOW

当前实现的`scow-scheduluer-adapter-interface`版本:v1.5.0
当前实现的`scow-scheduluer-adapter-interface`版本:v1.6.0

## Build

Expand Down
63 changes: 63 additions & 0 deletions caller/caller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package caller

import (
"database/sql"
"io"
"log"
"os"
"scow-slurm-adapter/utils"

_ "github.com/go-sql-driver/mysql"
"github.com/sirupsen/logrus"
"gopkg.in/natefinch/lumberjack.v2"
)

var (
DB *sql.DB
ConfigValue *utils.Config
Logger *logrus.Logger
)

func init() {
currentPwd, _ := os.Getwd()
ConfigValue = utils.ParseConfig(currentPwd + "/" + utils.DefaultConfigPath)
initDB()
initLogger()
}

func initDB() {
var (
err error
)
dbConfig := utils.DatabaseConfig()
DB, err = sql.Open("mysql", dbConfig)
if err != nil {
log.Fatal(err)
}
// 测试数据库连接
err = DB.Ping()
if err != nil {
log.Fatal(err)
}
// defer DB.Close()
}

func initLogger() {
Logger = logrus.New()
// 设置日志输出格式为JSON
Logger.SetFormatter(&logrus.JSONFormatter{})
// 设置日志级别为Info
Logger.SetLevel(logrus.InfoLevel)

// 创建一个 lumberjack.Logger,用于日志轮转配置
logFile := &lumberjack.Logger{
Filename: "server.log", // 日志文件路径
MaxSize: 100, // 日志文件的最大大小(以MB为单位)
MaxBackups: 5, // 保留的旧日志文件数量
MaxAge: 50, // 保留的旧日志文件的最大天数
LocalTime: true, // 使用本地时间戳
Compress: true, // 是否压缩旧日志文件
}
Logger.SetOutput(io.MultiWriter(os.Stdout, logFile))
defer logFile.Close()
}
6 changes: 5 additions & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ slurm:
# module profile文件路径
modulepath:
path: /lustre/software/module/5.2.0/init/profile.sh


# 计算分区描述
partitiondesc:
- name: compute # 这个是计算分区名
desc: "这是普通的cpu计算分区" # 这是描述
39 changes: 12 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,26 @@ module scow-slurm-adapter
go 1.19

require (
github.com/go-ldap/ldap/v3 v3.4.4
github.com/go-sql-driver/mysql v1.7.1
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
github.com/wxnacy/wgo v1.0.4
golang.org/x/crypto v0.8.0
google.golang.org/grpc v1.55.0
google.golang.org/protobuf v1.30.0
google.golang.org/grpc v1.64.0
google.golang.org/protobuf v1.33.0
)

require gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
require (
github.com/kr/pretty v0.3.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

require (
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pkg/sftp v1.13.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
gopkg.in/yaml.v3 v3.0.1
)
499 changes: 15 additions & 484 deletions go.sum

Large diffs are not rendered by default.

Loading

0 comments on commit 0fa0d67

Please sign in to comment.