| | 56 | System.Console.WriteLine("Total Tasks: {0}", lines.Count); |
|---|
| | 57 | int loadBalance = (lines.Count / m_workers); |
|---|
| | 58 | System.Console.WriteLine("LoadBalance: {0}", loadBalance); |
|---|
| | 59 | int totalQueues = 0; |
|---|
| | 60 | int totalTasksEnqueued = 0; |
|---|
| | 61 | List<string> operation = new List<string>(); |
|---|
| | 62 | for (int l = 0; l < lines.Count; l++) { |
|---|
| | 63 | string thisLine = lines[l]; |
|---|
| | 64 | operation.Add(thisLine); |
|---|
| | 65 | if (operation.Count >= loadBalance) { |
|---|
| | 66 | System.Console.WriteLine("Operation Length: {0}", operation.Count); |
|---|
| | 67 | q.EnqueueTask(InvokeOperation<T>(operation)); |
|---|
| | 68 | totalTasksEnqueued += operation.Count; |
|---|
| | 69 | operation = new List<string>(); |
|---|
| | 70 | totalQueues += 1; |
|---|
| | 71 | } |
|---|
| | 72 | } |
|---|
| | 73 | |
|---|
| | 74 | if (operation.Count > 0) { |
|---|
| | 75 | totalTasksEnqueued += operation.Count; |
|---|
| | 76 | totalQueues += 1; |
|---|
| | 77 | q.EnqueueTask(InvokeOperation<T>(operation)); |
|---|
| | 78 | } |
|---|
| | 79 | |
|---|
| | 80 | System.Console.WriteLine("Total Tasks Enqueued: {0}, Total Queues: {1}", totalTasksEnqueued, totalQueues); |
|---|
| 109 | | KeyValuePair<string, string>[] geoNames = new KeyValuePair<System.String, System.String>[] { |
|---|
| 110 | | new KeyValuePair<string,string>("geonamesid",(string)inputArray.GetValue(0)), |
|---|
| 111 | | new KeyValuePair<string,string>("names",(string)inputArray.GetValue(1)), |
|---|
| 112 | | new KeyValuePair<string,string>("alternatenames",(string)inputArray.GetValue(3)), |
|---|
| 113 | | new KeyValuePair<string,string>("latitude", (string)inputArray.GetValue(4)), |
|---|
| 114 | | new KeyValuePair<string,string>("longitude", (string)inputArray.GetValue(5)), |
|---|
| 115 | | new KeyValuePair<string,string>("feature_class", (string)inputArray.GetValue(6)), |
|---|
| 116 | | new KeyValuePair<string,string>("feature_code",(string)inputArray.GetValue(7)), |
|---|
| 117 | | new KeyValuePair<string,string>("country_code",(string)inputArray.GetValue(8)), |
|---|
| 118 | | new KeyValuePair<string,string>("cc2",(string)inputArray.GetValue(9)), |
|---|
| 119 | | new KeyValuePair<string,string>("admin1_code",(string)inputArray.GetValue(10)), |
|---|
| 120 | | new KeyValuePair<string,string>("admin2_code",(string)inputArray.GetValue(11)), |
|---|
| 121 | | new KeyValuePair<string,string>("admin3_code",(string)inputArray.GetValue(12)), |
|---|
| 122 | | new KeyValuePair<string,string>("admin4_code",(string)inputArray.GetValue(13)), |
|---|
| 123 | | new KeyValuePair<string,string>("population",(string)inputArray.GetValue(14)), |
|---|
| 124 | | new KeyValuePair<string,string>("elevation",(string)inputArray.GetValue(15)), |
|---|
| 125 | | new KeyValuePair<string,string>("gtopo30",(string)inputArray.GetValue(16)), |
|---|
| 126 | | new KeyValuePair<string,string>("timezone",(string)inputArray.GetValue(17)), |
|---|
| 127 | | new KeyValuePair<string,string>("modification_date",(string)inputArray.GetValue(18)), |
|---|
| 128 | | }; |
|---|
| 129 | | |
|---|
| | 117 | KeyValuePair<string, string>[] geoNames = |
|---|
| | 118 | new KeyValuePair<System.String, System.String>[] { |
|---|
| | 119 | new KeyValuePair<string,string>("geonamesid",(string)inputArray.GetValue(0)), |
|---|
| | 120 | new KeyValuePair<string,string>("names",(string)inputArray.GetValue(1)), |
|---|
| | 121 | new KeyValuePair<string,string>("alternatenames",(string)inputArray.GetValue(3)), |
|---|
| | 122 | new KeyValuePair<string,string>("latitude", (string)inputArray.GetValue(4)), |
|---|
| | 123 | new KeyValuePair<string,string>("longitude", (string)inputArray.GetValue(5)), |
|---|
| | 124 | new KeyValuePair<string,string>("feature_class", (string)inputArray.GetValue(6)), |
|---|
| | 125 | new KeyValuePair<string,string>("feature_code",(string)inputArray.GetValue(7)), |
|---|
| | 126 | new KeyValuePair<string,string>("country_code",(string)inputArray.GetValue(8)), |
|---|
| | 127 | new KeyValuePair<string,string>("cc2",(string)inputArray.GetValue(9)), |
|---|
| | 128 | new KeyValuePair<string,string>("admin1_code",(string)inputArray.GetValue(10)), |
|---|
| | 129 | new KeyValuePair<string,string>("admin2_code",(string)inputArray.GetValue(11)), |
|---|
| | 130 | new KeyValuePair<string,string>("admin3_code",(string)inputArray.GetValue(12)), |
|---|
| | 131 | new KeyValuePair<string,string>("admin4_code",(string)inputArray.GetValue(13)), |
|---|
| | 132 | new KeyValuePair<string,string>("population",(string)inputArray.GetValue(14)), |
|---|
| | 133 | new KeyValuePair<string,string>("elevation",(string)inputArray.GetValue(15)), |
|---|
| | 134 | new KeyValuePair<string,string>("gtopo30",(string)inputArray.GetValue(16)), |
|---|
| | 135 | new KeyValuePair<string,string>("timezone",(string)inputArray.GetValue(17)), |
|---|
| | 136 | new KeyValuePair<string,string>("modification_date",(string)inputArray.GetValue(18)), |
|---|
| | 137 | }; |
|---|