mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-02-20 17:57:30 +01:00
Merge pull request #492 from ClusterCockpit/dev
Add log output and fix bugs in AppTagger
This commit is contained in:
@@ -52,7 +52,10 @@ func (t *AppTagger) scanApp(f *os.File, fns string) {
|
|||||||
ai := appInfo{tag: tag, patterns: make([]*regexp.Regexp, 0)}
|
ai := appInfo{tag: tag, patterns: make([]*regexp.Regexp, 0)}
|
||||||
|
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := strings.TrimSpace(scanner.Text())
|
||||||
|
if line == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
re, err := regexp.Compile(line)
|
re, err := regexp.Compile(line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclog.Errorf("invalid regex pattern '%s' in %s: %v", line, fns, err)
|
cclog.Errorf("invalid regex pattern '%s' in %s: %v", line, fns, err)
|
||||||
@@ -68,6 +71,8 @@ func (t *AppTagger) scanApp(f *os.File, fns string) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cclog.Infof("AppTagger loaded %d patterns for %s", len(ai.patterns), tag)
|
||||||
t.apps = append(t.apps, ai)
|
t.apps = append(t.apps, ai)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +91,9 @@ func (t *AppTagger) EventCallback() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, fn := range files {
|
for _, fn := range files {
|
||||||
|
if fn.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
fns := fn.Name()
|
fns := fn.Name()
|
||||||
cclog.Debugf("Process: %s", fns)
|
cclog.Debugf("Process: %s", fns)
|
||||||
f, err := os.Open(filepath.Join(t.cfgPath, fns))
|
f, err := os.Open(filepath.Join(t.cfgPath, fns))
|
||||||
@@ -121,6 +129,9 @@ func (t *AppTagger) Register() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, fn := range files {
|
for _, fn := range files {
|
||||||
|
if fn.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
fns := fn.Name()
|
fns := fn.Name()
|
||||||
cclog.Debugf("Process: %s", fns)
|
cclog.Debugf("Process: %s", fns)
|
||||||
f, err := os.Open(filepath.Join(t.cfgPath, fns))
|
f, err := os.Open(filepath.Join(t.cfgPath, fns))
|
||||||
@@ -164,8 +175,8 @@ func (t *AppTagger) Match(job *schema.Job) {
|
|||||||
if re.MatchString(jobscriptLower) {
|
if re.MatchString(jobscriptLower) {
|
||||||
if !r.HasTag(id, t.tagType, a.tag) {
|
if !r.HasTag(id, t.tagType, a.tag) {
|
||||||
r.AddTagOrCreateDirect(id, t.tagType, a.tag)
|
r.AddTagOrCreateDirect(id, t.tagType, a.tag)
|
||||||
break out
|
|
||||||
}
|
}
|
||||||
|
break out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,11 +276,11 @@
|
|||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
<Card>
|
<Card>
|
||||||
<Table hover>
|
<Table hover responsive>
|
||||||
<thead>
|
<thead>
|
||||||
<!-- Header Row 1: Titles and Sorting -->
|
<!-- Header Row 1: Titles and Sorting -->
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:10%; max-width:12.5%;" onclick={() => sortBy('hostname')}>
|
<th style="width: 7.5%; min-width: 100px; max-width:10%;" onclick={() => sortBy('hostname')}>
|
||||||
Host
|
Host
|
||||||
<Icon
|
<Icon
|
||||||
name="caret-{healthTableSorting['hostname'].dir}{healthTableSorting['hostname']
|
name="caret-{healthTableSorting['hostname'].dir}{healthTableSorting['hostname']
|
||||||
@@ -289,7 +289,7 @@
|
|||||||
: ''}"
|
: ''}"
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th style="width:10%; max-width:12.5%;" onclick={() => sortBy('schedulerState')}>
|
<th style="width: 8.5%; min-width: 100px; max-width:10%;" onclick={() => sortBy('schedulerState')}>
|
||||||
Scheduler State
|
Scheduler State
|
||||||
<Icon
|
<Icon
|
||||||
name="caret-{healthTableSorting['schedulerState'].dir}{healthTableSorting['schedulerState']
|
name="caret-{healthTableSorting['schedulerState'].dir}{healthTableSorting['schedulerState']
|
||||||
@@ -298,7 +298,7 @@
|
|||||||
: ''}"
|
: ''}"
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th style="width:10%; max-width:12.5%;" onclick={() => sortBy('healthState')}>
|
<th style="width: 7.5%; min-width: 100px; max-width:10%;" onclick={() => sortBy('healthState')}>
|
||||||
Health State
|
Health State
|
||||||
<Icon
|
<Icon
|
||||||
name="caret-{healthTableSorting['healthState'].dir}{healthTableSorting['healthState']
|
name="caret-{healthTableSorting['healthState'].dir}{healthTableSorting['healthState']
|
||||||
@@ -343,17 +343,17 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{#each filteredTableData as host (host.hostname)}
|
{#each filteredTableData as host (host.hostname)}
|
||||||
<tr>
|
<tr>
|
||||||
<th><b><a href="/monitoring/node/{cluster}/{host.hostname}" target="_blank">{host.hostname}</a></b></th>
|
<th scope="row"><b><a href="/monitoring/node/{cluster}/{host.hostname}" target="_blank">{host.hostname}</a></b></th>
|
||||||
<td>{host.schedulerState}</td>
|
<td>{host.schedulerState}</td>
|
||||||
<td>{host.healthState}</td>
|
<td>{host.healthState}</td>
|
||||||
<td>
|
<td style="max-width: 250px;">
|
||||||
{#each Object.keys(host.healthData) as hkey}
|
{#each Object.keys(host.healthData) as hkey}
|
||||||
<p>
|
<p>
|
||||||
<b>{hkey}</b>: {host.healthData[hkey]}
|
<b>{hkey}</b>: {host.healthData[hkey]}
|
||||||
</p>
|
</p>
|
||||||
{/each}
|
{/each}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style="max-width: 250px;">
|
||||||
{#each Object.keys(host.metaData) as mkey}
|
{#each Object.keys(host.metaData) as mkey}
|
||||||
<p>
|
<p>
|
||||||
<b>{mkey}</b>: {host.metaData[mkey]}
|
<b>{mkey}</b>: {host.metaData[mkey]}
|
||||||
|
|||||||
Reference in New Issue
Block a user