-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Containers: Fix mpirun issue where it cannot contact the workers
There is an intermittent issue where mpirun cannot contact the workers even though nslookup can successfully resolve their DNS hostnames in the Init Container. This is seen somewhat infrequently, but has happened enough. The end result causes the user containers to restart (if restartLimit > 0), and it always seems to work on the second try. This seems to solve the issue by using the Init Continer to use mpirun to contact the workers and just get their hostnames. This replaces the use of nslookup and ensures that mpirun can be successful on the launcher. To support this, the Init Container must run as the given UID/GID rather than root. It also speeds up container start times as we only need to run 1 Init Container for all of the workers rather than an Init Container for each worker. I have not been able to reproduce the original error using int-test, which would (in)frequently catch this. Signed-off-by: Blake Devcich <[email protected]>
- Loading branch information
Showing
9 changed files
with
510 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Mateusz Wielbut | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# pointy | ||
|
||
Simple helper functions to provide a shorthand to get a pointer to a variable holding a constant...because it's annoying when you have to do it hundreds of times in unit tests: | ||
|
||
```golang | ||
|
||
val := 42 | ||
pointerToVal := &val | ||
// vs. | ||
pointerToVal := pointy.Int(42) // if using Go 1.17 or earlier w/o generics | ||
pointerToVal := pointy.Pointer(42) // if using Go 1.18+ w/ generics | ||
``` | ||
|
||
### New in release 2.0.0 | ||
|
||
🚨 Breaking change | ||
|
||
Package has changed to `go.openly.dev`. Please use | ||
``` | ||
import "go.openly.dev/pointy" | ||
``` | ||
|
||
### New in release 1.2.0 | ||
|
||
Generic implementation of the pointer-to-value and value-to-pointer functions. *Requires Go 1.18+.* | ||
The type-specific functions are still available for backwards-compatibility. | ||
|
||
```golang | ||
pointerToInt := pointy.Pointer(42) | ||
pointerToString := pointy.Pointer("foo") | ||
// then later in your code.. | ||
intValue := pointy.PointerValue(pointerToInt, 99) | ||
stringValue := pointy.PointerValue(pointerToString, "bar") | ||
``` | ||
|
||
Convenience functions to safely compare pointers by their dereferenced values: | ||
|
||
```golang | ||
// when both values are pointers | ||
a := pointy.Int(1) | ||
b := pointy.Int(1) | ||
if pointy.PointersValueEqual(a, b) { | ||
fmt.Println("a and b contain equal dereferenced values") | ||
} | ||
|
||
// or if just one is a pointer | ||
a := pointy.Int(1) | ||
b := 1 | ||
if pointy.PointerValueEqual(a, b) { | ||
fmt.Println("a and b contain equal dereferenced values") | ||
} | ||
``` | ||
|
||
### New in release 1.1.0 | ||
|
||
Additional helper functions have been added to safely dereference pointers | ||
or return a fallback value: | ||
|
||
```golang | ||
val := 42 | ||
pointerToVal := &val | ||
// then later in your code.. | ||
myVal := pointy.IntValue(pointerToVal, 99) // returns 42 (or 99 if pointerToVal was nil) | ||
``` | ||
|
||
## GoDoc | ||
|
||
[https://godoc.org/github.com/openly-engineering/pointy](https://pkg.go.dev/github.com/openly-engineering/pointy) | ||
|
||
## Installation | ||
|
||
`go get go.openly.dev/pointy` | ||
|
||
## Example | ||
|
||
```golang | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"go.openly.dev/pointy" | ||
) | ||
|
||
func main() { | ||
foo := pointy.Pointer(2018) | ||
fmt.Println("foo is a pointer to:", *foo) | ||
|
||
bar := pointy.Pointer("point to me") | ||
fmt.Println("bar is a pointer to:", *bar) | ||
|
||
// get the value back out (new in v1.1.0) | ||
barVal := pointy.PointerValue(bar, "empty!") | ||
fmt.Println("bar's value is:", barVal) | ||
} | ||
``` | ||
|
||
## Available Functions | ||
|
||
`Pointer[T any](x T) *T` | ||
`PointerValue[T any](p *T, fallback T) T` | ||
`Bool(x bool) *bool` | ||
`BoolValue(p *bool, fallback bool) bool` | ||
`Byte(x byte) *byte` | ||
`ByteValue(p *byte, fallback byte) byte` | ||
`Complex128(x complex128) *complex128` | ||
`Complex128Value(p *complex128, fallback complex128) complex128` | ||
`Complex64(x complex64) *complex64` | ||
`Complex64Value(p *complex64, fallback complex64) complex64` | ||
`Float32(x float32) *float32` | ||
`Float32Value(p *float32, fallback float32) float32` | ||
`Float64(x float64) *float64` | ||
`Float64Value(p *float64, fallback float64) float64` | ||
`Int(x int) *int` | ||
`IntValue(p *int, fallback int) int` | ||
`Int8(x int8) *int8` | ||
`Int8Value(p *int8, fallback int8) int8` | ||
`Int16(x int16) *int16` | ||
`Int16Value(p *int16, fallback int16) int16` | ||
`Int32(x int32) *int32` | ||
`Int32Value(p *int32, fallback int32) int32` | ||
`Int64(x int64) *int64` | ||
`Int64Value(p *int64, fallback int64) int64` | ||
`Uint(x uint) *uint` | ||
`UintValue(p *uint, fallback uint) uint` | ||
`Uint8(x uint8) *uint8` | ||
`Uint8Value(p *uint8, fallback uint8) uint8` | ||
`Uint16(x uint16) *uint16` | ||
`Uint16Value(p *uint16, fallback uint16) uint16` | ||
`Uint32(x uint32) *uint32` | ||
`Uint32Value(p *uint32, fallback uint32) uint32` | ||
`Uint64(x uint64) *uint64` | ||
`Uint64Value(p *uint64, fallback uint64) uint64` | ||
`String(x string) *string` | ||
`StringValue(p *string, fallback string) string` | ||
`Rune(x rune) *rune` | ||
`RuneValue(p *rune, fallback rune) rune` | ||
`PointersValueEqual[T comparable](a *T, b *T) bool` | ||
`PointerValueEqual[T comparable](a *T, b T) bool` | ||
## Motivation | ||
|
||
Creating pointers to literal constant values is useful, especially in unit tests. Go doesn't support simply using the address operator (&) to reference the location of e.g. `value := &int64(42)` so we're forced to [create](https://stackoverflow.com/questions/35146286/find-address-of-constant-in-go/35146856#35146856) [little](https://stackoverflow.com/questions/34197248/how-can-i-store-reference-to-the-result-of-an-operation-in-go/34197367#34197367) [workarounds](https://stackoverflow.com/questions/30716354/how-do-i-do-a-literal-int64-in-go/30716481#30716481). A common solution is to create a helper function: | ||
|
||
```golang | ||
func createInt64Pointer(x int64) *int64 { | ||
return &x | ||
} | ||
// now you can create a pointer to 42 inline | ||
value := createInt64Pointer(42) | ||
``` | ||
|
||
This package provides a library of these simple little helper functions for every native Go primitive. | ||
|
||
Made @ Openly. [Join us](https://careers.openly.com/) and use Go to build cool stuff. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package pointy | ||
|
||
// PointersValueEqual returns true if both pointer parameters are nil or contain the same dereferenced value. | ||
func PointersValueEqual[T comparable](a *T, b *T) bool { | ||
if a == nil && b == nil { | ||
return true | ||
} | ||
if a != nil && b != nil && *a == *b { | ||
return true | ||
} | ||
|
||
return false | ||
} | ||
|
||
// PointerValueEqual returns true if the pointer parameter is not nil and contains the same dereferenced value as the value parameter. | ||
func PointerValueEqual[T comparable](a *T, b T) bool { | ||
if a == nil { | ||
return false | ||
} | ||
if *a == b { | ||
return true | ||
} | ||
|
||
return false | ||
} |
Oops, something went wrong.