Skip to content

Commit

Permalink
cmd/run,job/job: Pass runtime configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
  • Loading branch information
nderjung committed Dec 20, 2020
1 parent f9c82b5 commit a9fab5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
16 changes: 8 additions & 8 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ func init() {

// doRunCmd
func doRunCmd(cmd *cobra.Command, args []string) {
j, err := job.NewJob(args[0])
if err != nil {
log.Fatalf("Could not read configuration: %s", err)
os.Exit(1)
}

setupInterruptHandler()

// Determine CPU sets
cpus, err := parseCpuSets(runConfig.CpuSets)
if err != nil {
log.Errorf("Could not parse CPU sets: %s", err)
os.Exit(1)
}

j, err := job.NewJob(args[0], &job.RuntimeConfig{
Cpus: cpus,
})
if err != nil {
log.Fatalf("Could not read configuration: %s", err)
os.Exit(1)
}

// Prepare environment
err = run.PrepareEnvironment(cpus, runConfig.DryRun)
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ type Job struct {
waitList *List
}

// RuntimeConfig contains details about the runtime of ukbench
type RuntimeConfig struct {
Cpus []int
}

// NewJob prepares a job yaml file
func NewJob(filePath string) (*Job, error) {
func NewJob(filePath string, cfg *RuntimeConfig) (*Job, error) {
// Check if the path is set
if len(filePath) == 0 {
return nil, fmt.Errorf("File path cannot be empty")
Expand Down

0 comments on commit a9fab5b

Please sign in to comment.