mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-01 03:03:50 +02:00
Refine app detection
Switch to regexp
This commit is contained in:
parent
983aa592d8
commit
7531ba4b5c
@ -152,13 +152,13 @@ func (r *JobRepository) removeTagFromArchiveJobs(jobIds []int64) {
|
||||
for _, j := range jobIds {
|
||||
tags, err := r.getArchiveTags(&j)
|
||||
if err != nil {
|
||||
log.Warn("Error while getting tags for job")
|
||||
log.Warnf("Error while getting tags for job %d", j)
|
||||
continue
|
||||
}
|
||||
|
||||
job, err := r.FindByIdDirect(j)
|
||||
if err != nil {
|
||||
log.Warn("Error while getting job")
|
||||
log.Warnf("Error while getting job %d", j)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
pw
|
||||
neb
|
||||
ph
|
2
internal/tagger/apps/starccm.txt
Normal file
2
internal/tagger/apps/starccm.txt
Normal file
@ -0,0 +1,2 @@
|
||||
starccm+
|
||||
-podkey
|
@ -11,6 +11,7 @@ import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/ClusterCockpit/cc-backend/internal/repository"
|
||||
@ -111,7 +112,8 @@ func (t *AppTagger) Match(job *schema.Job) {
|
||||
for _, a := range t.apps {
|
||||
tag := a.tag
|
||||
for _, s := range a.strings {
|
||||
if strings.Contains(strings.ToLower(jobscript), fmt.Sprintf(" %s ", s)) {
|
||||
matched, _ := regexp.MatchString(s, strings.ToLower(jobscript))
|
||||
if matched {
|
||||
if !r.HasTag(id, t.tagType, tag) {
|
||||
r.AddTagOrCreateDirect(id, t.tagType, tag)
|
||||
break out
|
||||
|
Loading…
x
Reference in New Issue
Block a user