This commit is contained in:
Christoph Kluge 2023-04-12 10:57:59 +02:00
commit 483443afe6
8 changed files with 30 additions and 31 deletions

View File

@ -2,7 +2,7 @@ TARGET = ./cc-backend
VAR = ./var
DB = ./var/job.db
FRONTEND = ./web/frontend
VERSION = 0.1
VERSION = 1
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
LD_FLAGS = '-s -X main.buildTime=${CURRENT_TIME} -X main.version=${VERSION} -X main.hash=${GIT_HASH}'

View File

@ -84,6 +84,8 @@ func main() {
fmt.Printf("Version:\t%s\n", version)
fmt.Printf("Git hash:\t%s\n", hash)
fmt.Printf("Build time:\t%s\n", buildTime)
fmt.Printf("SQL db version:\t%d\n", repository.Version)
fmt.Printf("Job archive version:\t%d\n", archive.Version)
os.Exit(0)
}

View File

@ -6,45 +6,45 @@
},
"clusters": [
{
"name": "emmy",
"name": "fritz",
"metricDataRepository": {
"kind": "cc-metric-store",
"url": "http://localhost:8081",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ1c2VyIjoiYWRtaW4iLCJyb2xlcyI6WyJST0xFX0FETUlOIiwiUk9MRV9BTkFMWVNUIiwiUk9MRV9VU0VSIl19.d-3_3FZTsadPjDEdsWrrQ7nS0edMAR4zjl-eK7rJU3HziNBfI9PDHDIpJVHTNN5E5SlLGLFXctWyKAkwhXL-Dw"
"url": "http://localhost:8082",
"token": ""
},
"filterRanges": {
"numNodes": {
"from": 1,
"to": 32
"to": 64
},
"duration": {
"from": 0,
"to": 172800
"to": 86400
},
"startTime": {
"from": "2010-01-01T00:00:00Z",
"from": "2022-01-01T00:00:00Z",
"to": null
}
}
},
{
"name": "woody",
"name": "alex",
"metricDataRepository": {
"kind": "cc-metric-store",
"url": "http://localhost:8081",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ1c2VyIjoiYWRtaW4iLCJyb2xlcyI6WyJST0xFX0FETUlOIiwiUk9MRV9BTkFMWVNUIiwiUk9MRV9VU0VSIl19.d-3_3FZTsadPjDEdsWrrQ7nS0edMAR4zjl-eK7rJU3HziNBfI9PDHDIpJVHTNN5E5SlLGLFXctWyKAkwhXL-Dw"
"url": "http://localhost:8082",
"token": ""
},
"filterRanges": {
"numNodes": {
"from": 1,
"to": 1
"to": 64
},
"duration": {
"from": 0,
"to": 172800
"to": 86400
},
"startTime": {
"from": "2015-01-01T00:00:00Z",
"from": "2022-01-01T00:00:00Z",
"to": null
}
}

View File

@ -30,7 +30,7 @@ import (
)
// @title ClusterCockpit REST API
// @version 0.2.0
// @version 1
// @description API for batch job control.
// @tag.name Job API

View File

@ -17,7 +17,7 @@ import (
"github.com/golang-migrate/migrate/v4/source/iofs"
)
const supportedVersion uint = 3
const Version uint = 3
//go:embed migrations/*
var migrationFiles embed.FS
@ -65,13 +65,13 @@ func checkDBVersion(backend string, db *sql.DB) {
}
}
if v < supportedVersion {
log.Warnf("Unsupported database version %d, need %d.\nPlease backup your database file and run cc-backend --migrate-db", v, supportedVersion)
if v < Version {
log.Warnf("Unsupported database version %d, need %d.\nPlease backup your database file and run cc-backend --migrate-db", v, Version)
os.Exit(0)
}
if v > supportedVersion {
log.Warnf("Unsupported database version %d, need %d.\nPlease refer to documentation how to downgrade db with external migrate tool!", v, supportedVersion)
if v > Version {
log.Warnf("Unsupported database version %d, need %d.\nPlease refer to documentation how to downgrade db with external migrate tool!", v, Version)
os.Exit(0)
}
}

View File

@ -13,10 +13,10 @@ import (
"github.com/ClusterCockpit/cc-backend/pkg/schema"
)
const Version = 1
const Version uint64 = 1
type ArchiveBackend interface {
Init(rawConfig json.RawMessage) (int, error)
Init(rawConfig json.RawMessage) (uint64, error)
LoadJobMeta(job *schema.Job) (*schema.JobMeta, error)

View File

@ -101,7 +101,7 @@ func loadJobData(filename string, isCompressed bool) (schema.JobData, error) {
}
}
func (fsa *FsArchive) Init(rawConfig json.RawMessage) (int, error) {
func (fsa *FsArchive) Init(rawConfig json.RawMessage) (uint64, error) {
var config FsArchiveConfig
if err := json.Unmarshal(rawConfig, &config); err != nil {
@ -121,7 +121,7 @@ func (fsa *FsArchive) Init(rawConfig json.RawMessage) (int, error) {
return 0, err
}
version, err := strconv.Atoi(strings.TrimSuffix(string(b), "\n"))
version, err := strconv.ParseUint(strings.TrimSuffix(string(b), "\n"), 10, 64)
if err != nil {
log.Errorf("fsBackend Init()- %v", err)
return 0, err

View File

@ -5,16 +5,13 @@ if [ -d './var' ]; then
./cc-backend --server --dev
else
make
cd var
wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive-dev.tar.xz
tar xJf job-archive-dev.tar.xz
rm ./job-archive-dev.tar.xz
cd ../
wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive-demo.tar
tar xf job-archive-demo.tar
rm ./job-archive-demo.tar
cp ./configs/env-template.txt .env
cp ./docs/config.json config.json
./cc-backend --migrate-db
./cc-backend --server --dev --init-db --add-user demo:admin:AdminDev
./cc-backend --server --dev --init-db --add-user demo:admin:demo
fi