개정판 06f13e11
한글 파일명 다운로드 에러 수정
멀티 서비스 수정
Change-Id: I1a7eb48f1c758d32c805eb0394c66b92f9d27330
ConvertService/ServiceBase/Markus.Service.Station/StationService/ServiceStationTask.cs | ||
---|---|---|
129 | 129 |
{ |
130 | 130 |
using (DataBase.ConvertDatabase database = new DataBase.ConvertDatabase(MarkusDBConnectionString)) |
131 | 131 |
{ |
132 |
var convertItems = database.GetWaitConvertItems(this.RunProjectList, StationServiceList.Sum(f=>f.Properties.PROCESS_COUNT)); |
|
132 |
var convertItems = database.GetWaitConvertItems(this.RunProjectList, StationServiceList.Where(x=>x.IsOnline).Sum(f=>f.Properties.PROCESS_COUNT));
|
|
133 | 133 |
|
134 | 134 |
foreach (var convert in convertItems) |
135 | 135 |
{ |
... | ... | |
149 | 149 |
{ |
150 | 150 |
try |
151 | 151 |
{ |
152 |
var result = subservice.Service.AliveConvertList();
|
|
152 |
subservice.IsOnline = SytemNet.Ping(subservice.Properties.SERVICE_ADDRESS);
|
|
153 | 153 |
|
154 |
subservice.ConvertItems = result.ToList(); |
|
155 |
subservice.AliveCount = result.Count(); |
|
154 |
if (subservice.IsOnline) |
|
155 |
{ |
|
156 |
var result = subservice.Service.AliveConvertList(); |
|
157 |
|
|
158 |
subservice.ConvertItems = result.ToList(); |
|
159 |
subservice.AliveCount = result.Count(); |
|
160 |
} |
|
161 |
else |
|
162 |
{ |
|
163 |
logger.Error($"Connection Error {subservice.Properties.SERVICE_ADDRESS}"); |
|
164 |
subservice.ConvertItems = new List<WcfClient.StationServiceAsync.ConvertItem>(); |
|
165 |
subservice.AliveCount = subservice.Properties.PROCESS_COUNT; |
|
166 |
} |
|
156 | 167 |
} |
157 | 168 |
catch (Exception ex) |
158 | 169 |
{ |
... | ... | |
161 | 172 |
} |
162 | 173 |
} |
163 | 174 |
|
175 |
|
|
164 | 176 |
private void PassConvertItem(string ProjectNo,string ConvertID) |
165 | 177 |
{ |
166 | 178 |
|
167 |
ReflashSubService(); |
|
168 |
|
|
169 | 179 |
try |
170 | 180 |
{ |
171 | 181 |
|
172 |
if (StationServiceList.SelectMany(x => x.ConvertItems).Count(c => c.ProjectNumber == ProjectNo && c.ConvertID == ConvertID) == 0) |
|
182 |
var stationList = StationServiceList.Where(x => x.IsOnline); |
|
183 |
|
|
184 |
if (stationList.SelectMany(x => x.ConvertItems).Count(c => c.ProjectNumber == ProjectNo && c.ConvertID == ConvertID) == 0) |
|
173 | 185 |
{ |
174 |
var station = StationServiceList.OrderBy(x => x.AliveCount).FirstOrDefault();
|
|
186 |
var station = stationList.OrderByDescending(x => x.Properties.PROCESS_COUNT - x.AliveCount).FirstOrDefault();
|
|
175 | 187 |
|
176 | 188 |
if (station != null) |
177 | 189 |
{ |
178 |
var result = station.Service.ConvertAdd(ProjectNo, ConvertID);
|
|
190 |
station.Service.ConvertAddAsync(ProjectNo, ConvertID);
|
|
179 | 191 |
logger.Info($"PassConvertItem - Service ID : {station.Properties.ID} ConvertID : {ConvertID}"); |
180 | 192 |
} |
181 | 193 |
} |
... | ... | |
186 | 198 |
} |
187 | 199 |
} |
188 | 200 |
|
189 |
private void CleanUpItems() |
|
201 |
private void CleanUpAliveQueueItems() |
|
202 |
{ |
|
203 |
var processList = Process.GetProcessesByName("Markus.Service.ConvertProcess"); |
|
204 |
|
|
205 |
if (processList.Length == 0) |
|
206 |
{ |
|
207 |
AliveConvertQueue.Clear(); |
|
208 |
System.Diagnostics.Debug.WriteLine("AliveConvertQueue.Clear()"); |
|
209 |
} |
|
210 |
else |
|
211 |
{ |
|
212 |
var argumentList = processList.Select(f => f.Arguments().CommandLine).SelectMany(f => f); |
|
213 |
|
|
214 |
for (int i = AliveConvertQueue.Count - 1; i >= 0; --i) |
|
215 |
{ |
|
216 |
if (argumentList.Count(x => x == AliveConvertQueue[i].ConvertID) == 0) |
|
217 |
{ |
|
218 |
AliveConvertQueue.RemoveAt(i); |
|
219 |
} |
|
220 |
} |
|
221 |
|
|
222 |
//foreach (var process in processList) |
|
223 |
//{ |
|
224 |
// var arguments = process.Arguments(); |
|
225 |
|
|
226 |
// if (arguments.CommandLine?.Count() == 2) |
|
227 |
// { |
|
228 |
// if (AliveConvertQueue.Count(x => x.ConvertID == arguments.CommandLine.First()) == 0) |
|
229 |
// { |
|
230 |
// var convetContext = ObjectToBytesStringConvert.BytesStringToObject<ProcessContext>(AESEncrypter.Decrypt(arguments.CommandLine[1])); |
|
231 |
|
|
232 |
// if (convetContext.ServiceStationUri == this.gServiceHostAddress.ToString()) |
|
233 |
// { |
|
234 |
// process.Kill(); |
|
235 |
// } |
|
236 |
// } |
|
237 |
// } |
|
238 |
//} |
|
239 |
} |
|
240 |
|
|
241 |
} |
|
242 |
|
|
243 |
private void CleanUpDataBaseItems() |
|
190 | 244 |
{ |
191 | 245 |
using (DataBase.ConvertDatabase database = new DataBase.ConvertDatabase(MarkusDBConnectionString)) |
192 | 246 |
{ |
193 | 247 |
var items = database.GetConvertingItems(RunProjectList); |
194 | 248 |
|
195 |
List<StationService.ConvertItem> aliveItems = new List<StationService.ConvertItem>();
|
|
249 |
List< WcfClient.StationServiceAsync.ConvertItem> aliveItems = new List<WcfClient.StationServiceAsync.ConvertItem>();
|
|
196 | 250 |
|
197 |
foreach (var item in StationServiceList) |
|
251 |
foreach (var item in StationServiceList.Where(x=>x.IsOnline))
|
|
198 | 252 |
{ |
199 | 253 |
try |
200 | 254 |
{ |
... | ... | |
274 | 328 |
|
275 | 329 |
System.Diagnostics.Debug.WriteLine("ServiceStation.AliveConvertQueue.Count() : " + ServiceStation.AliveConvertQueue.Count()); |
276 | 330 |
|
331 |
if (IsStation) |
|
332 |
{ |
|
333 |
System.Diagnostics.Debug.WriteLine("setDataBaseWaitingList"); |
|
334 |
setDataBaseWaitingList(); |
|
335 |
System.Diagnostics.Debug.WriteLine("ReleaseItems end"); |
|
336 |
} |
|
337 |
else |
|
338 |
{ |
|
339 |
if (StationClient != null) |
|
340 |
{ |
|
341 |
StationClient.ReleaseConvertItems(); |
|
342 |
} |
|
343 |
} |
|
277 | 344 |
//if (ServiceStation.AliveConvertQueue.Count() < MultiProcessCount) |
278 | 345 |
//{ |
279 | 346 |
// setDataBaseWaitingList(); |
내보내기 Unified diff