From c67d8276b7cf874c56e69a7ffa6f4f4168680634 Mon Sep 17 00:00:00 2001 From: Helin Wang Date: Mon, 24 Jul 2017 23:10:37 +0000 Subject: [PATCH] fix according to comments --- go/master/c/client.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/go/master/c/client.go b/go/master/c/client.go index 6d329937f0..a2b18e4b47 100644 --- a/go/master/c/client.go +++ b/go/master/c/client.go @@ -22,6 +22,9 @@ package main #define PADDLE_MASTER_OK 0 #define PADDLE_MASTER_ERROR -1 +#define PADDLE_SAVE_MODEL_OK 1 +#define PADDLE_SAVE_MODEL_SKIP 0 + typedef int paddle_master_client; */ import "C" @@ -146,7 +149,7 @@ func paddle_next_record(client C.paddle_master_client, record **C.uchar) C.int { // paddle_request_save_model requests the master server to approve the // caller to save the model. // -// returns 1 if the save the model request is approved, 0 if does the +// returns 1 if the save the model request is approved, 0 if the // request is rejected because other trainer is saving the model, -1 // if error happened. // @@ -156,14 +159,14 @@ func paddle_request_save_model(client C.paddle_master_client, trainerID string, need, err := c.RequestSaveModel(trainerID, time.Duration(blockMS)*time.Millisecond) if err != nil { log.Errorln(err) - return -1 + return C.PADDLE_MASTER_ERROR } if need { - return 1 + return C.PADDLE_SAVE_MODEL_OK } - return 0 + return C.PADDLE_SAVE_MODEL_SKIP } //export mem_free -- GitLab