MCPcopy
hub / github.com/NVIDIA/aistore / initProxyURL

Function initProxyURL

devtools/tutils/init.go:168–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166}
167
168func initProxyURL() (err error) {
169 // Discover if a proxy is ready to accept requests.
170 err = cmn.NetworkCallWithRetry(&cmn.RetryArgs{
171 Call: func() (int, error) { return 0, GetProxyReadiness(proxyURLReadOnly) },
172 SoftErr: 5,
173 HardErr: 5,
174 Sleep: 5 * time.Second,
175 Action: fmt.Sprintf("reach AIS at %s", proxyURLReadOnly),
176 IsClient: true,
177 })
178 if err != nil {
179 return fmt.Errorf("AIS is unreachable at %s", proxyURLReadOnly)
180 }
181
182 if testClusterType == ClusterTypeK8s {
183 // For kubernetes cluster, we use LoadBalancer service to expose the proxies.
184 // `proxyURLReadOnly` will point to LoadBalancer service, and we need not get primary URL.
185 return
186 }
187
188 // Primary proxy can change if proxy tests are run and
189 // no new cluster is re-deployed before each test.
190 // Finds who is the current primary proxy.
191 primary, err := GetPrimaryProxy(proxyURLReadOnly)
192 if err != nil {
193 err = fmt.Errorf("failed to get primary proxy info from %s; err %v", proxyURLReadOnly, err)
194 return err
195 }
196 proxyURLReadOnly = primary.URL(cmn.NetPublic)
197 return
198}
199
200func initPmap() {
201 baseParams := BaseAPIParams(proxyURLReadOnly)

Callers 1

InitClusterFunction · 0.85

Calls 4

NetworkCallWithRetryFunction · 0.92
GetPrimaryProxyFunction · 0.85
GetProxyReadinessFunction · 0.70
URLMethod · 0.45

Tested by

no test coverage detected