Skip to content

Commit

Permalink
[ci] archive static templates with binary (#95)
Browse files Browse the repository at this point in the history
* archive static templates with binary

* update docs
  • Loading branch information
abhinavDhulipala authored Aug 28, 2024
1 parent 790e8f7 commit 6e7dada
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ tmp*
coverage.html
coverage.out
.DS_Store
dist
10 changes: 8 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
#
# SPDX-License-Identifier: Apache-2.0

version: 2
builds:
-
goos:
- goos:
- linux
goarch:
- amd64
- arm
- arm64

archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
files:
- src: ./exporter/templates/*
dst: templates
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ $ curl localhost:9092/metrics | grep "# HELP"
### Exporter Env Var Docs

Env vars can be sepcified in a `.env` file, while using the `just`
| Var | Default Value | Purpose |
|---------------|---------------|-----------------------------------------------------------------------------|
| POLL_LIMIT | 10 | # of seconds to wait before polling slurmctl again (client-side throttling) |
| LOGLEVEL | info | Log Level: debug, info, warn, error |
| CLI_TIMEOUT | 10. | # seconds before the exporter terminates command. |
| Var | Default Value | Purpose |
|-----------------|---------------|-----------------------------------------------------------------------------|
| POLL_LIMIT | 10 | # of seconds to wait before polling slurmctl again (client-side throttling) |
| LOGLEVEL | info | Log Level: debug, info, warn, error |
| CLI_TIMEOUT | 10. | # seconds before the exporter terminates command. |
| TRACE_ROOT_PATH | "cwd" | path to ./templates directory where html files are located |


### Future work
Add scheduler info, slurmrestd support, package binary into apt, rpm packages, and docker
slurmrestd support
8 changes: 7 additions & 1 deletion exporter/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io/fs"
"log"
"net/http"
"os"
"path/filepath"
"sync"
"text/template"
Expand Down Expand Up @@ -106,8 +107,13 @@ type TraceCollector struct {

func NewTraceCollector(config *Config) *TraceCollector {
traceConfig := config.TraceConf
templateRootDir := "."
// path to look for the /templates directory. Defaults to cwd
if path, ok := os.LookupEnv("TRACE_ROOT_PATH"); ok {
templateRootDir = path
}
traceDir := ""
err := filepath.WalkDir(".", func(path string, d fs.DirEntry, err error) error {
err := filepath.WalkDir(templateRootDir, func(path string, d fs.DirEntry, err error) error {
if err == nil && d.IsDir() && d.Name() == templateDirName {
traceDir = path
return nil
Expand Down

0 comments on commit 6e7dada

Please sign in to comment.