MCPcopy Create free account
hub / github.com/PaddlePaddle/PaddleCloud / writeCacheStatus

Method writeCacheStatus

pkg/sampleset/manager/server.go:391–423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389}
390
391func (s *Server) writeCacheStatus() {
392 filePath := s.svrOpt.ServerDir +
393 common.PathCacheStatus + "/" +
394 common.FilePathCacheInfo
395 var interval int64 = 5
396
397 for {
398 if interval >= s.svrOpt.Interval {
399 time.Sleep(time.Duration(s.svrOpt.Interval) * time.Second)
400 } else {
401 time.Sleep(time.Duration(interval) * time.Second)
402 interval += 2
403 }
404
405 status := &v1alpha1.CacheStatus{}
406 err := s.CreateCacheStatus(s.svrOpt, status)
407 if err != nil {
408 status.ErrorMassage = err.Error()
409 s.Log.Error(err, "")
410 }
411 body, err := json.Marshal(status)
412 if err != nil {
413 s.Log.Error(err, "marshal cache status error")
414 continue
415 }
416 err = ioutil.WriteFile(filePath, body, os.ModePerm)
417 if err != nil {
418 s.Log.Error(err, "write cache status error")
419 continue
420 }
421 s.Log.V(1).Info("write cache status success")
422 }
423}
424
425func extractPattern(path string) string {
426 if strings.Contains(path, common.PathSyncOptions) {

Callers 1

RunMethod · 0.95

Calls 2

ErrorMethod · 0.80
CreateCacheStatusMethod · 0.65

Tested by

no test coverage detected