Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/slurm-tracker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
func main() {
// Configure zerolog
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
zerolog.SetGlobalLevel(zerolog.InfoLevel)
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})

if err := rootCmd.Execute(); err != nil {
Expand All @@ -41,6 +42,11 @@ var rootCmd = &cobra.Command{
}

func preRun(cmd *cobra.Command, args []string) error {
if cfg.Debug {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
log.Debug().Msg("Debug logging enabled")
}

// Validate required flags
apiKey, _ := cmd.Flags().GetString("api-key")
if apiKey == "" {
Expand Down Expand Up @@ -153,6 +159,7 @@ func init() {
rootCmd.Flags().StringVar(&cfg.PlatformHost, "api-server", os.Getenv("PW_PLATFORM_HOST"), "Platform host to send api requests to (defaults to PW_PLATFORM_HOST env var)")
rootCmd.Flags().StringVar(&cfg.StateFile, "state-file", "", "File to store running job states (defaults to ./slurm_job_states.db)")
rootCmd.Flags().StringVar(&cfg.ConfigFilePath, "config", "config.json", "Path to config file with account/allocation mappings")
rootCmd.Flags().BoolVarP(&cfg.Debug, "debug", "d", false, "Enable debug logging")

// not checking error since its not possible here
// required flags are checked in preRun
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Config struct {
OrganizationName string
LookbackMinutes int
DryRun bool
Debug bool
PlatformHost string
StateFile string
ConfigFilePath string
Expand Down
61 changes: 0 additions & 61 deletions internal/slurm/detect.go

This file was deleted.

Loading
Loading