diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index a74036e..433449b 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -64,7 +64,7 @@ for _, p := range params { // stable order by p.Order - This module is versioned as v9 in the module path. If releasing a new major version, update module path and coordinate with downstream consumers. ## Where to look next / follow-ups -- If you need runtime examples of how these models are consumed, search in the `cyverse-de` organization for imports of `github.com/cyverse-de/model/v9`. +- If you need runtime examples of how these models are consumed, search in the `cyverse-de` organization for imports of `github.com/cyverse-de/model/**`. - Add small focused tests for behavioral changes: a happy path + one edge case (e.g., collection trailing slash handling). If any section is unclear or you'd like the file to include more examples (test examples, typical JSON payloads, or a small quick-start snippet for local testing), tell me which part and I'll iterate. diff --git a/container.go b/container.go index bddb7b5..7fb17ab 100644 --- a/container.go +++ b/container.go @@ -64,6 +64,7 @@ type Container struct { MinGPUs int64 `json:"min_gpus"` // The minimum number of GPUs the container needs. MinDiskSpace int64 `json:"min_disk_space"` // The minimum amount of disk space that the container needs. PIDsLimit int64 `json:"pids_limit"` + GPUModels []string `json:"gpu_models"` // A list of acceptable GPU models. Empty means no limitation. Image ContainerImage `json:"image"` EntryPoint string `json:"entrypoint"` WorkingDir string `json:"working_directory"` diff --git a/container_test.go b/container_test.go index f55c3ec..2781870 100644 --- a/container_test.go +++ b/container_test.go @@ -272,3 +272,26 @@ func TestPorts(t *testing.T) { t.Error("bind to host was false") } } +func TestStepContainerGPUModels(t *testing.T) { + s := inittests(t) + gpumodels := s.Steps[0].Component.Container.GPUModels + nummodels := len(gpumodels) + if nummodels != 1 { + t.Errorf("The number of GPU models was '%d' instead of 1", nummodels) + } + + if gpumodels[0] != "NVIDIA-A16" { + t.Errorf("The first GPU model was '%s' instead of 'NVIDIA-A16'", gpumodels[0]) + } +} + +func TestStepContainerGPUModelsEmpty(t *testing.T) { + s := inittestsFile(t, "test/no_volumes_submission.json") + gpumodels := s.Steps[0].Component.Container.GPUModels + if gpumodels == nil { + gpumodels = []string{} + } + if len(gpumodels) != 0 { + t.Errorf("The number of GPU models was '%d' instead of 0 when not specified", len(gpumodels)) + } +} diff --git a/go.mod b/go.mod index a0aeb1b..94ed04d 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/cyverse-de/model/v9 +module github.com/cyverse-de/model/v10 go 1.24 diff --git a/jobs.go b/jobs.go index d898213..ca133d8 100644 --- a/jobs.go +++ b/jobs.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "github.com/cyverse-de/model/v9/submitfile" + "github.com/cyverse-de/model/v10/submitfile" "github.com/spf13/viper" ) diff --git a/test/test_submission.json b/test/test_submission.json index 77efde4..0e90352 100644 --- a/test/test_submission.json +++ b/test/test_submission.json @@ -36,6 +36,7 @@ "tag":"latest", "name":"gims.iplantcollaborative.org:5000/backwards-compat" }, + "gpu_models": ["NVIDIA-A16"], "container_volumes_from" : [ { "name":"vf-name1",