Skip to content

Commit

Permalink
chore: master.yaml synonym for singularity as apptainer (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
CanmingCobble authored and determined-ci committed Feb 2, 2024
1 parent de150d2 commit 9d76adc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion master/internal/config/dispatcher_resource_manager_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type DispatcherResourceManagerConfig struct {
UserName string `json:"user_name"`
GroupName string `json:"group_name"`
SingularityImageRoot string `json:"singularity_image_root"`
ApptainerImageRoot string `json:"apptainer_image_root"`
JobStorageRoot string `json:"job_storage_root"`
Path string `json:"path"`
LdLibraryPath string `json:"ld_library_path"`
Expand Down Expand Up @@ -70,6 +71,9 @@ func (c DispatcherResourceManagerConfig) Validate() []error {
c.LauncherContainerRunType == enroot) {
return []error{fmt.Errorf("invalid launch container run type: '%s'", c.LauncherContainerRunType)}
}
if c.ApptainerImageRoot != "" && c.SingularityImageRoot != "" {
return []error{fmt.Errorf("apptainer_image_root and singularity_image_root cannot be both set")}
}
return c.validateJobProjectSource()
}

Expand Down Expand Up @@ -99,7 +103,16 @@ var defaultDispatcherResourceManagerConfig = DispatcherResourceManagerConfig{
func (c *DispatcherResourceManagerConfig) UnmarshalJSON(data []byte) error {
*c = defaultDispatcherResourceManagerConfig
type DefaultParser *DispatcherResourceManagerConfig
return json.Unmarshal(data, DefaultParser(c))
if err := json.Unmarshal(data, DefaultParser(c)); err != nil {
return err
}
if c.ApptainerImageRoot != "" {
c.SingularityImageRoot = c.ApptainerImageRoot
}
if c.LauncherContainerRunType == "apptainer" {
c.LauncherContainerRunType = "singularity"
}
return nil
}

// ResolveSlotType resolves the slot type by first looking for a partition-specific setting,
Expand Down

0 comments on commit 9d76adc

Please sign in to comment.