Skip to content

Commit

Permalink
Add age categories filter (#5)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Rosie Kern <rk18@sanger.ac.uk>
  • Loading branch information
rk1274 and rk1274 authored Oct 31, 2024
1 parent 0add142 commit f8730c6
Show file tree
Hide file tree
Showing 26 changed files with 557 additions and 308 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ issues:
- revive
- path: internal
linters:
- mnd
- gomnd
- funlen
- path: cmd
Expand Down
16 changes: 8 additions & 8 deletions cmd/dbinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/spf13/cobra"
"github.com/wtsi-hgi/wrstat-ui/server"
"github.com/wtsi-ssg/wrstat/v5/basedirs"
"github.com/wtsi-ssg/wrstat/v5/dgut"
"github.com/wtsi-ssg/wrstat/v5/dguta"
)

// dbinfoCmd represents the server command.
Expand All @@ -51,7 +51,7 @@ NB: for large databases, this can take hours to run.
die("you must supply the path to your 'wrstat multi -f' output directory")
}

dbPaths, err := server.FindLatestDgutDirs(args[0], dgutDBsSuffix)
dbPaths, err := server.FindLatestDgutaDirs(args[0], dgutaDBsSuffix)
if err != nil {
die("failed to find database paths: %s", err)
}
Expand All @@ -63,15 +63,15 @@ NB: for large databases, this can take hours to run.

slog.SetLogLoggerLevel(slog.LevelDebug)

info("opening dgut databases...")
dgutDB := dgut.NewDB(dbPaths...)
dbInfo, err := dgutDB.Info()
info("opening dguta databases...")
dgutaDB := dguta.NewDB(dbPaths...)
dbInfo, err := dgutaDB.Info()
if err != nil {
die("failed to get dgut db info: %s", err)
die("failed to get dguta db info: %s", err)
}

cliPrint("\nDirs: %d\nDGUTs: %d\nParents: %d\nChildren: %d\n\n",
dbInfo.NumDirs, dbInfo.NumDGUTs, dbInfo.NumParents, dbInfo.NumChildren)
cliPrint("\nDirs: %d\nDGUTAs: %d\nParents: %d\nChildren: %d\n\n",
dbInfo.NumDirs, dbInfo.NumDGUTAs, dbInfo.NumParents, dbInfo.NumChildren)

info("opening basedir database...\n")

Expand Down
22 changes: 11 additions & 11 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ import (
)

const (
sentinelPollFrequencty = 1 * time.Minute
serverTokenBasename = ".wrstat.servertoken"
dgutDBsSuffix = "dgut.dbs"
basedirBasename = "basedirs.db"
dgutDBsSentinelBasename = ".dgut.dbs.updated"
sentinelPollFrequencty = 1 * time.Minute
serverTokenBasename = ".wrstat.servertoken"
dgutaDBsSuffix = "dguta.dbs"
basedirBasename = "basedirs.db"
dgutaDBsSentinelBasename = ".dguta.dbs.updated"
)

// options for this cmd.
Expand All @@ -70,7 +70,7 @@ var serverCmd = &cobra.Command{
Long: `Start the web server.
Starting the web server brings up a web interface and REST API that will use the
latest *.dgut.dbs directory and basedirs.db inside the given 'wrstat multi'
latest *.dguta.dbs directory and basedirs.db inside the given 'wrstat multi'
output directory to answer questions about where data is on the disks. (Provide
your 'wrstat multi -f' argument as an unamed argument to this command.)
Expand Down Expand Up @@ -102,7 +102,7 @@ The server must be running for 'wrstat where' calls to succeed.
This command will block forever in the foreground; you can background it with
ctrl-z; bg. Or better yet, use the daemonize program to daemonize this.
It will monitor a file called ".dgut.dbs.updated" in the given directory and
It will monitor a file called ".dguta.dbs.updated" in the given directory and
attempt to reload the databases when the file is updated by another run of
'wrstat multi' with the same output directory. After reloading, will delete the
previous run's database files. It will use the mtime of the file as the data
Expand Down Expand Up @@ -153,7 +153,7 @@ creation time in reports.
}

info("opening databases, please wait...")
dbPaths, err := server.FindLatestDgutDirs(args[0], dgutDBsSuffix)
dbPaths, err := server.FindLatestDgutaDirs(args[0], dgutaDBsSuffix)
if err != nil {
die("failed to find database paths: %s", err)
}
Expand All @@ -163,7 +163,7 @@ creation time in reports.
die("failed to find basedirs database path: %s", err)
}

err = s.LoadDGUTDBs(dbPaths...)
err = s.LoadDGUTADBs(dbPaths...)
if err != nil {
die("failed to load database: %s", err)
}
Expand All @@ -173,9 +173,9 @@ creation time in reports.
die("failed to load database: %s", err)
}

sentinel := filepath.Join(args[0], dgutDBsSentinelBasename)
sentinel := filepath.Join(args[0], dgutaDBsSentinelBasename)

err = s.EnableDGUTDBReloading(sentinel, args[0], dgutDBsSuffix, sentinelPollFrequencty)
err = s.EnableDGUTADBReloading(sentinel, args[0], dgutaDBsSuffix, sentinelPollFrequencty)
if err != nil {
die("failed to set up database reloading: %s", err)
}
Expand Down
27 changes: 16 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
module github.com/wtsi-hgi/wrstat-ui

go 1.22
go 1.22.0

toolchain go1.22.4

require (
code.cloudfoundry.org/bytefmt v0.2.0
code.cloudfoundry.org/bytefmt v0.16.0
github.com/dustin/go-humanize v1.0.1
github.com/gin-gonic/gin v1.10.0
github.com/inconshreveable/log15 v2.16.0+incompatible
github.com/olekukonko/tablewriter v0.0.5
github.com/smartystreets/goconvey v1.7.2
github.com/spf13/cobra v1.8.1
github.com/wtsi-hgi/go-authserver v1.3.0
github.com/wtsi-ssg/wrstat/v5 v5.0.0
github.com/wtsi-ssg/wrstat/v5 v5.2.1
)

require (
Expand Down Expand Up @@ -40,6 +42,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
Expand All @@ -58,6 +61,7 @@ require (
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/smartystreets/assertions v1.13.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/thanhpk/randstr v1.0.6 // indirect
Expand All @@ -66,15 +70,16 @@ require (
github.com/wtsi-ssg/wr v0.5.9 // indirect
go.etcd.io/bbolt v1.3.11 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.7.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/tylerb/graceful.v1 v1.2.15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading

0 comments on commit f8730c6

Please sign in to comment.