public override Task <Stat> LoadJobConfig(CellJobConfig config, ServerCallContext context) { try { var jobConfig = new JobConfig { Connections = config.Connections, ConcurrentConnections = config.ConcurrentConnections, // Slaves = config.Slaves, Interval = config.Interval, Duration = config.Duration, ServerUrl = config.ServerUrl, Pipeline = new List <string>(config.Pipeline.Split(';')), }; // TODO: handle exception if (_sigWorker == null) { _sigWorker = new SigWorker(); } _sigWorker.LoadJobs(jobConfig); _sigWorker.UpdateState(Stat.Types.State.ConfigLoaded); return(Task.FromResult(new Stat { State = Stat.Types.State.ConfigLoaded })); } catch (Exception ex) { Util.Log($"Exception: {ex}"); throw; } }
public override Task <Stat> CreateWorker(Empty empty, ServerCallContext context) { try { if (_sigWorker != null) { _sigWorker.UpdateState(Stat.Types.State.WorkerExisted); return(Task.FromResult(new Stat { State = Stat.Types.State.WorkerExisted })); } _sigWorker = new SigWorker(); _sigWorker.UpdateState(Stat.Types.State.WorkerCreated); return(Task.FromResult(new Stat { State = Stat.Types.State.WorkerCreated })); } catch (Exception ex) { Util.Log($"Exception: {ex}"); throw; } }