11 func makeTime() string {
13 return t.Format(time.RFC3339)
17 func Create(serviceParam ServiceParam) []byte {
18 instanceCount := serviceParam.Count
20 ret := ServiceExecutionResponse{}
21 ret.ServiceList = make([]ServiceExecutionItem, instanceCount)
23 for index := 0; index < instanceCount; index++ {
26 log.Println("servicName: ", serviceParam.ServiceName)
27 id, msgChan, ctlChan := CreateServiceMap(cmd, serviceParam.ServiceName, serviceParam.AppName)
28 log.Println("id : ", id)
30 go Push(id, msgChan, ctlChan)
32 serviceInfo := ServiceExecutionItem{id, makeTime()}
33 ret.ServiceList[index] = serviceInfo
36 sibytes, _ := json.Marshal(ret)
40 // Run is for executing service
41 func Run(distService DistService, serviceID uint64) {
42 serviceName, err := GetServiceName(serviceID)
44 log.Println(err.Error())
49 for _, userParam := range distService.UserParam.Args {
50 args = append(args, userParam)
53 args = append(args, distService.SystemParam.IP)
54 args = append(args, strconv.Itoa(distService.SystemParam.Port))
55 args = append(args, "--remote")
57 service := Service{serviceID, serviceName, args}