Changeset 3220
- Timestamp:
- 03/25/10 19:57:44 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 1 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Console/3.2/HiveClientConsole.cs
r3203 r3220 531 531 onlineTimes = e.Result.ToList<Appointment>(); 532 532 onlineTimes.ForEach(a => a.BorderColor = Color.Red); 533 dvOnline.Invalidate(); 534 533 535 } 534 536 else -
trunk/sources/HeuristicLab.Hive.Client.Core/3.2/ConfigurationManager/UptimeManager.cs
r3203 r3220 33 33 return instance; 34 34 } 35 } 36 37 public UptimeManager() { 38 RestoreFromHDD(); 35 39 } 36 40 -
trunk/sources/HeuristicLab.Hive.Client.Core/3.2/Core.cs
r3203 r3220 311 311 /// <param name="e"></param> 312 312 void wcfService_SendJobCompleted(object sender, SendJobCompletedEventArgs e) { 313 Logging.Instance.Info(this.ToString(), "Received new job with id " + e.Result.Job.Id);314 if (e.Result.StatusMessage != ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT) {313 if (e.Result.StatusMessage != ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT) { 314 Logging.Instance.Info(this.ToString(), "Received new job with id " + e.Result.Job.Id); 315 315 bool sandboxed = false; 316 316 List<byte[]> files = new List<byte[]>(); -
trunk/sources/HeuristicLab.Hive.Client.Core/3.2/JobStorage/JobStorageManager.cs
r2846 r3220 63 63 Logging.Instance.Error("JobStorageManager", "Job not on hdd but on list - deleting job from list", e); 64 64 storedJobsList.Remove(storedJobsList[index - 1]); 65 StoreJobList(); 65 66 } 66 67 … … 82 83 83 84 XmlSerializer serializer = new XmlSerializer(typeof(List<JobStorageInfo>)); 85 FileStream stream = null; 84 86 if(File.Exists(Path.Combine(path ,"list.xml"))) { 85 87 try { 86 FileStreamstream = new FileStream(Path.Combine(path, "list.xml"), FileMode.Open);88 stream = new FileStream(Path.Combine(path, "list.xml"), FileMode.Open); 87 89 XmlTextReader reader = new XmlTextReader(stream); 88 90 storedJobsList = (List<JobStorageInfo>)serializer.Deserialize(reader); … … 91 93 catch (Exception e) { 92 94 Logging.Instance.Error("JobStorageManager", "Exception while loading the Stored Job List", e); 95 } finally { 96 if(stream != null) 97 stream.Dispose(); 93 98 } 94 99 } else { -
trunk/sources/HeuristicLab.Hive.Contracts/3.2/Interfaces/IExecutionEngineFacade.cs
r3011 r3220 33 33 ResponseObject<JobDto> AddJob(SerializedJob job); 34 34 [OperationContract] 35 ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob jobObj, IEnumerable<string> groups); 36 [OperationContract] 35 37 Response RequestSnapshot(Guid jobId); 36 38 [OperationContract] 37 39 ResponseObject<SerializedJob> GetLastSerializedResult(Guid jobId, bool requested); 38 40 [OperationContract] 39 Response AbortJob(Guid jobId); 41 Response AbortJob(Guid jobId); 40 42 } 41 43 } -
trunk/sources/HeuristicLab.Hive.Contracts/3.2/Interfaces/IJobManager.cs
r3011 r3220 61 61 [OperationContract] 62 62 ResponseList<JobDto> GetJobsByProject(Guid projectId); 63 [OperationContract] 64 ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources); 63 65 } 64 66 } -
trunk/sources/HeuristicLab.Hive.Engine/3.2/HiveEngine.cs
r3018 r3220 94 94 var jobObj = CreateJobObj(); 95 95 IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(HiveServerUrl); 96 97 if(!String.Empty.Equals(RessourceIds)) { 96 97 List<string> groups = new List<string>(); 98 if (!String.Empty.Equals(RessourceIds)) { 99 groups.AddRange(RessourceIds.Split(';')); 100 } 101 102 /*if(!String.Empty.Equals(RessourceIds)) { 98 103 String[] ids = RessourceIds.Split(';'); 99 104 foreach (string sid in ids) { … … 105 110 } 106 111 } 107 } 112 } */ 108 113 109 114 int loops = 1; … … 114 119 115 120 for (int i = 0; i < loops; i++) { 116 ResponseObject<Contracts.BusinessObjects.JobDto> res = executionEngineFacade.AddJob (jobObj);121 ResponseObject<Contracts.BusinessObjects.JobDto> res = executionEngineFacade.AddJobWithGroupStrings(jobObj, groups); 117 122 jobId = res.Obj.Id; 118 123 } -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/CgCalendar.Designer.cs
r3203 r3220 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 Calendar.DrawTool drawTool 2= new Calendar.DrawTool();26 Calendar.DrawTool drawTool1 = new Calendar.DrawTool(); 27 27 this.dvOnline = new Calendar.DayView(); 28 28 this.btnSaveCal = new System.Windows.Forms.Button(); … … 46 46 // dvOnline 47 47 // 48 drawTool 2.DayView = this.dvOnline;49 this.dvOnline.ActiveTool = drawTool 2;48 drawTool1.DayView = this.dvOnline; 49 this.dvOnline.ActiveTool = drawTool1; 50 50 this.dvOnline.AmPmDisplay = false; 51 51 this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes; … … 67 67 this.dvOnline.StartDate = new System.DateTime(((long)(0))); 68 68 this.dvOnline.TabIndex = 42; 69 this.dvOnline.OnSelectionChanged += new System.EventHandler<System.EventArgs>(this.dvOnline_OnSelectionChanged); 69 70 // 70 71 // btnSaveCal … … 231 232 this.Controls.Add(this.dvOnline); 232 233 this.Name = "CgCalendar"; 233 this.Text = "Calendar";234 234 this.groupBox1.ResumeLayout(false); 235 235 this.groupBox1.PerformLayout(); -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/CgCalendar.cs
r3203 r3220 28 28 29 29 public Guid ResourceId { get; set; } 30 public string Name { get; set; } 30 31 31 32 [XmlArray("Appointments")] … … 33 34 public List<Appointment> onlineTimes = new List<Appointment>(); 34 35 35 public CgCalendar(Guid resourceId) { 36 public CgCalendar(Guid resourceId, String name) { 37 Name = name; 36 38 ResourceId = resourceId; 39 this.Text = Name + "(" + ResourceId + ")"; 37 40 InitializeComponent(); 38 41 InitCalender(); -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs
r3022 r3220 131 131 menuItemOpenCalendar.Click += (s, e) => { 132 132 if (tvClientControl.SelectedNode != null) { 133 CgCalendar cal = new CgCalendar(((ClientGroupDto)tvClientControl.SelectedNode.Tag).Id );133 CgCalendar cal = new CgCalendar(((ClientGroupDto)tvClientControl.SelectedNode.Tag).Id, ((ClientGroupDto)tvClientControl.SelectedNode.Tag).Name); 134 134 cal.Show(); 135 135 } -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs
r3203 r3220 41 41 using Linq = HeuristicLab.Hive.Server.LINQDataAccess; 42 42 using System.Transactions; 43 using HeuristicLab.Hive.Server.LINQDataAccess; 43 44 44 45 namespace HeuristicLab.Hive.Server.Core { … … 107 108 " wasn't offline but hasn't sent heartbeats - Resetting all his jobs"); 108 109 foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) { 109 jobManager.ResetJobsDependingOnResults(job); 110 //maybe implementa n additional Watchdog? Till then, just set them offline.. 111 DaoLocator.JobDao.SetJobOffline(job); 112 //jobManager.ResetJobsDependingOnResults(job); 110 113 } 111 114 } else { … … 193 196 heartbeatLock.ExitWriteLock(); 194 197 198 ClientDto dbClient = DaoLocator.ClientDao.FindById(clientInfo.Id); 199 200 //Really set offline? 201 //Reconnect issues with the currently calculating jobs 195 202 clientInfo.State = State.idle; 196 197 if (DaoLocator.ClientDao.FindById(clientInfo.Id) == null) 203 clientInfo.CalendarSyncStatus = dbClient != null ? dbClient.CalendarSyncStatus : CalendarState.NotAllowedToFetch; 204 205 if (dbClient == null) 198 206 DaoLocator.ClientDao.Insert(clientInfo); 199 207 else … … 336 344 private void processJobProcess(HeartBeatData hbData, ResponseHB response) { 337 345 HiveLogger.Info(this.ToString() + " processJobProcess: Started for Client " + hbData.ClientId); 338 339 if (hbData.JobProgress != null && hbData.JobProgress.Count > 0) { 340 List<JobDto> jobsOfClient = new List<JobDto>(DaoLocator.JobDao.FindActiveJobsOfClient(DaoLocator.ClientDao.FindById(hbData.ClientId))); 346 List<JobDto> jobsOfClient = new List<JobDto>(DaoLocator.JobDao.FindActiveJobsOfClient(DaoLocator.ClientDao.FindById(hbData.ClientId))); 347 if (hbData.JobProgress != null && hbData.JobProgress.Count > 0) { 341 348 if (jobsOfClient == null || jobsOfClient.Count == 0) { 342 349 response.Success = false; … … 369 376 DaoLocator.JobDao.Update(curJob); 370 377 } 371 foreach (JobDto currJob in jobsOfClient) { 372 bool found = false; 378 } 379 foreach (JobDto currJob in jobsOfClient) { 380 bool found = false; 381 if(hbData.JobProgress != null) { 373 382 foreach (Guid jobId in hbData.JobProgress.Keys) { 374 383 if (jobId == currJob.Id) { … … 377 386 } 378 387 } 379 if (!found) { 380 lock (newAssignedJobs) { 381 if (newAssignedJobs.ContainsKey(currJob.Id)) { 382 newAssignedJobs[currJob.Id]--; 383 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL Reduced by one for job: " + currJob + "and is now: " + newAssignedJobs[currJob.Id] + ". User that sucks: " + currJob.Client); 384 if (newAssignedJobs[currJob.Id] <= 0) { 385 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 386 387 currJob.State = State.offline; 388 DaoLocator.JobDao.Update(currJob); 389 390 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, currJob.Id)); 391 392 newAssignedJobs.Remove(currJob.Id); 393 } 394 } else { 395 HiveLogger.Error(this.ToString() + " processJobProcess: Job ID wasn't with the heartbeats: " + currJob); 388 } 389 if (!found) { 390 lock (newAssignedJobs) { 391 if (newAssignedJobs.ContainsKey(currJob.Id)) { 392 newAssignedJobs[currJob.Id]--; 393 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL Reduced by one for job: " + currJob + "and is now: " + newAssignedJobs[currJob.Id] + ". User that sucks: " + currJob.Client); 394 if (newAssignedJobs[currJob.Id] <= 0) { 395 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 396 396 397 currJob.State = State.offline; 397 398 DaoLocator.JobDao.Update(currJob); 398 } 399 } // lock 400 } else { 401 lock (newAssignedJobs) { 402 403 if (newAssignedJobs.ContainsKey(currJob.Id)) { 404 HiveLogger.Info(this.ToString() + " processJobProcess: Job is sending a heart beat, removing it from the newAssignedJobList: " + currJob); 399 400 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, currJob.Id)); 401 405 402 newAssignedJobs.Remove(currJob.Id); 406 403 } 404 } else { 405 HiveLogger.Error(this.ToString() + " processJobProcess: Job ID wasn't with the heartbeats: " + currJob); 406 currJob.State = State.offline; 407 DaoLocator.JobDao.Update(currJob); 408 } 409 } // lock 410 } else { 411 lock (newAssignedJobs) { 412 413 if (newAssignedJobs.ContainsKey(currJob.Id)) { 414 HiveLogger.Info(this.ToString() + " processJobProcess: Job is sending a heart beat, removing it from the newAssignedJobList: " + currJob); 415 newAssignedJobs.Remove(currJob.Id); 407 416 } 408 417 } -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ClientFacade.cs
r3203 r3220 32 32 using System.ServiceModel; 33 33 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 34 using System.Transactions; 34 35 35 36 namespace HeuristicLab.Hive.Server.Core { … … 103 104 new MultiStream(); 104 105 105 ResponseJob job = 106 this.SendJob(clientId); 106 ResponseJob job = null; 107 108 job = this.SendJob(clientId); 107 109 108 110 //first send response … … 114 116 115 117 //second stream the job binary data 116 stream.AddStream( 117 ((IInternalJobManager)(jobManager)). 118 GetJobStreamById( 119 job.Job.Id)); 120 118 119 if(job.Job != null) 120 stream.AddStream( 121 ((IInternalJobManager) (jobManager)). 122 GetJobStreamById( 123 job.Job.Id)); 124 121 125 OperationContext clientContext = OperationContext.Current; 122 126 clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args) { -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/DbTestApp.cs
r3011 r3220 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Data.SqlClient; 24 25 using System.Text; 25 26 using HeuristicLab.PluginInfrastructure; … … 35 36 using HeuristicLab.Core; 36 37 using HeuristicLab.Hive.Server.LINQDataAccess; 38 using System.Transactions; 37 39 38 40 namespace HeuristicLab.Hive.Server { 39 41 [Application("Hive DB Test App", "Test Application for the Hive DataAccess Layer")] 40 42 class HiveDbTestApplication : ApplicationBase { 41 /* private void TestClientAdapter() { 42 IClientAdapter clientAdapter = 43 ServiceLocator.GetClientAdapter(); 44 45 ClientInfo client = new ClientInfo(); 46 client.Login = DateTime.Now; 47 clientAdapter.Update(client); 48 49 ClientInfo clientRead = 50 clientAdapter.GetById(client.Id); 51 Debug.Assert( 52 clientRead != null && 53 client.Id == clientRead.Id); 54 55 client.CpuSpeedPerCore = 2000; 56 clientAdapter.Update(client); 57 clientRead = 58 clientAdapter.GetById(client.Id); 59 Debug.Assert( 60 clientRead != null && 61 client.Id == clientRead.Id && 62 clientRead.CpuSpeedPerCore == 2000); 63 64 ICollection<ClientInfo> clients = 65 clientAdapter.GetAll(); 66 int count = clients.Count; 67 68 clientAdapter.Delete(client); 69 70 clients = clientAdapter.GetAll(); 71 Debug.Assert(count - 1 == clients.Count); 72 } 73 74 private void TestClientGroupAdapter() { 75 ISessionFactory factory = 76 ServiceLocator.GetSessionFactory(); 77 78 ISession session = 79 factory.GetSessionForCurrentThread(); 80 81 ITransaction trans = null; 82 83 try { 84 IClientGroupAdapter clientGroupAdapter = 85 session.GetDataAdapter<ClientGroup, IClientGroupAdapter>(); 86 87 trans = 88 session.BeginTransaction(); 89 90 ClientInfo client = 91 new ClientInfo(); 92 client.Name = "Stefan"; 93 client.Login = DateTime.Now; 94 95 ClientInfo client2 = 96 new ClientInfo(); 97 client2.Name = "Martin"; 98 client2.Login = DateTime.Now; 99 100 ClientInfo client3 = 101 new ClientInfo(); 102 client3.Name = "Heinz"; 103 client3.Login = DateTime.Now; 104 105 ClientGroup group = 106 new ClientGroup(); 107 108 ClientGroup subGroup = 109 new ClientGroup(); 110 subGroup.Resources.Add(client); 111 112 group.Resources.Add(client3); 113 group.Resources.Add(client2); 114 group.Resources.Add(subGroup); 115 116 clientGroupAdapter.Update(group); 117 118 ClientGroup read = 119 clientGroupAdapter.GetById(group.Id); 120 121 ICollection<ClientGroup> clientGroups = 122 clientGroupAdapter.GetAll(); 123 124 IClientAdapter clientAdapter = 125 session.GetDataAdapter<ClientInfo, IClientAdapter>(); 126 127 clientAdapter.Delete(client3); 128 129 read = 130 clientGroupAdapter.GetById(group.Id); 131 132 clientGroupAdapter.Delete(subGroup); 133 134 read = 135 clientGroupAdapter.GetById(group.Id); 136 137 clientGroups = 138 clientGroupAdapter.GetAll(); 139 140 clientGroupAdapter.Delete(group); 141 142 clientGroups = 143 clientGroupAdapter.GetAll(); 144 145 clientAdapter.Delete(client); 146 clientAdapter.Delete(client2); 147 } 148 finally { 149 if (trans != null) 150 trans.Rollback(); 151 152 session.EndSession(); 153 } 154 } 155 156 private void InsertTestClientGroups() { 157 ISessionFactory factory = 158 ServiceLocator.GetSessionFactory(); 159 160 ISession session = 161 factory.GetSessionForCurrentThread(); 162 163 ITransaction trans = null; 164 165 try { 166 IClientGroupAdapter clientGroupAdapter = 167 session.GetDataAdapter<ClientGroup, IClientGroupAdapter>(); 168 169 trans = 170 session.BeginTransaction(); 171 172 ClientInfo client = 173 new ClientInfo(); 174 client.Name = "Stefan"; 175 client.Login = DateTime.Now; 176 177 ClientInfo client2 = 178 new ClientInfo(); 179 client2.Name = "Martin"; 180 client2.Login = DateTime.Now; 181 182 ClientGroup group = 183 new ClientGroup(); 184 group.Name = "Gruppe1"; 185 186 ClientGroup subGroup = 187 new ClientGroup(); 188 subGroup.Name = "Untergruppe1"; 189 subGroup.Resources.Add(client); 190 191 group.Resources.Add(client2); 192 group.Resources.Add(subGroup); 193 194 clientGroupAdapter.Update(group); 195 196 trans.Commit(); 197 } 198 finally { 199 session.EndSession(); 200 } 201 } 202 203 private void TestJobAdapter() { 204 IJobAdapter jobAdapter = 205 ServiceLocator.GetJobAdapter(); 206 IClientAdapter clientAdapter = 207 ServiceLocator.GetClientAdapter(); 208 209 Job job = new Job(); 210 211 ClientInfo client = new ClientInfo(); 212 client.Login = DateTime.Now; 213 214 job.Client = client; 215 jobAdapter.Update(job); 216 217 ICollection<Job> jobs = jobAdapter.GetAll(); 218 219 jobAdapter.Delete(job); 220 clientAdapter.Delete(client); 221 222 jobs = jobAdapter.GetAll(); 223 } 224 225 private void TestJobResultsAdapter() { 226 Job job = new Job(); 227 228 ClientInfo client = new ClientInfo(); 229 client.Login = DateTime.Now; 230 231 job.Client = client; 232 233 IJobResultsAdapter resultsAdapter = 234 ServiceLocator.GetJobResultsAdapter(); 235 236 byte[] resultByte = {0x0f, 0x1f, 0x2f, 0x3f, 0x4f}; 237 238 JobResult result = new JobResult(); 239 result.Client = client; 240 result.Job = job; 241 result.Result = resultByte; 242 243 resultsAdapter.Update(result); 244 245 JobResult read = 246 resultsAdapter.GetById(result.Id); 247 Debug.Assert( 248 read.Id == result.Id && 249 result.Client.Id == read.Client.Id && 250 result.Job.Id == read.Job.Id && 251 result.Result == result.Result); 252 253 int count = 254 resultsAdapter.GetAll().Count; 255 256 resultsAdapter.Delete(result); 257 258 ICollection<JobResult> allResults = 259 resultsAdapter.GetAll(); 260 261 Debug.Assert(allResults.Count == count - 1); 262 263 IJobAdapter jboAdapter = 264 ServiceLocator.GetJobAdapter(); 265 jboAdapter.Delete(job); 266 IClientAdapter clientAdapter = 267 ServiceLocator.GetClientAdapter(); 268 clientAdapter.Delete(client); 269 } 270 271 private void TestTransaction() { 272 ISessionFactory factory = 273 ServiceLocator.GetSessionFactory(); 274 275 ISession session = 276 factory.GetSessionForCurrentThread(); 277 278 IClientAdapter clientAdapter = 279 session.GetDataAdapter<ClientInfo, IClientAdapter>(); 280 281 ITransaction trans = 282 session.BeginTransaction(); 283 284 ClientInfo client = new ClientInfo(); 285 client.Login = DateTime.Now; 286 clientAdapter.Update(client); 287 288 trans.Rollback(); 289 290 session.EndSession(); 291 } */ 292 293 private void TestJobStreaming() { 43 /*private void TestJobStreaming() { 294 44 ISessionFactory factory = 295 45 ServiceLocator.GetSessionFactory(); … … 489 239 490 240 //SpeedTest(); 491 TestJobBytearrFetching(); 492 241 //TestJobBytearrFetching(); 242 TestJobStreamFetching(); 243 244 } 245 246 private void TestJobStreamFetching() { 247 //using (TransactionScope scope = new TransactionScope()) { 248 HiveDataContext context = ContextFactory.Context; 249 250 ContextFactory.Context.Connection.Open(); 251 ContextFactory.Context.Transaction = ContextFactory.Context.Connection.BeginTransaction(); 252 253 ClientFacade facade = new ClientFacade(); 254 Stream stream = facade.SendStreamedJob(new Guid("F5CFB334-66A0-417C-A585-71711BA21D3F")); 255 256 byte[] buffer = new byte[3024]; 257 int read = 0; 258 259 while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) {} 260 261 stream.Close(); 262 263 //Stream stream = DaoLocator.JobDao.GetSerializedJobStream(new Guid("bbb51f87-4e2f-4499-a9b6-884e589c78b6")); 264 //} 493 265 } 494 266 -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ExecutionEngineFacade.cs
r3011 r3220 44 44 } 45 45 46 public ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources) { 47 return jobManager.AddJobWithGroupStrings(job, resources); 48 } 49 46 50 public Response RequestSnapshot(Guid jobId) { 47 51 return jobManager.RequestSnapshot(jobId); -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs
r3018 r3220 34 34 using HeuristicLab.Tracing; 35 35 using System.Transactions; 36 using HeuristicLab.Hive.Server.LINQDataAccess; 36 37 37 38 namespace HeuristicLab.Hive.Server.Core { … … 149 150 } 150 151 } */ 152 153 public ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources) { 154 IClientGroupDao cgd = DaoLocator.ClientGroupDao; 155 foreach (string res in resources) { 156 foreach(ClientGroupDto cg in cgd.FindByName(res)) { 157 job.JobInfo.AssignedResourceIds.Add(cg.Id); 158 } 159 } 160 return AddNewJob(job); 161 } 151 162 152 163 /// <summary> -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ServerConsoleFacade.cs
r3203 r3220 180 180 } 181 181 182 public ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources) { 183 return jobManager.AddJobWithGroupStrings(job, resources); 184 } 182 185 } 183 186 } -
trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/HeuristicLab.Hive.Server.DataAccess-3.2.csproj
r3022 r3220 93 93 <Compile Include="IJobResultsAdapter.cs" /> 94 94 <Compile Include="IResourceAdapter.cs" /> 95 <Compile Include="VarBinaryStream.cs" />96 95 </ItemGroup> 97 96 <ItemGroup> -
trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IClientGroupDao.cs
r3018 r3220 13 13 IEnumerable<ClientGroupDto> FindAllWithSubGroupsAndClients(); 14 14 IEnumerable<Guid> FindAllGroupAndParentGroupIdsForClient(Guid clientId); 15 16 IEnumerable<ClientGroupDto> FindByName(string res); 15 17 } 16 18 } -
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientGroupDao.cs
r3203 r3220 153 153 return target; 154 154 } 155 156 public IEnumerable<ClientGroupDto> FindByName(string res) { 157 return (from cq in Context.ClientGroups 158 where cq.Resource.Name == res 159 select EntityToDto(cq, null)).ToList(); 160 } 161 162 155 163 } 156 164 } -
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ContextFactory.cs
r3011 r3220 3 3 using System.Linq; 4 4 using System.Text; 5 using System.Data.Common; 6 using System.Data.SqlClient; 5 7 6 8 namespace HeuristicLab.Hive.Server.LINQDataAccess { … … 8 10 [ThreadStatic] 9 11 private static HiveDataContext _hiveDataContext; 12 13 [ThreadStatic] 14 private static SqlTransaction _currentTransaction; 10 15 11 16 public static HiveDataContext Context { … … 15 20 return _hiveDataContext; 16 21 } 17 set { 22 set { 18 23 _hiveDataContext = value; 19 24 } 20 25 } 26 27 public static SqlTransaction CurrentTransaction { 28 get { 29 return _currentTransaction; 30 } set { 31 _currentTransaction = value; 32 } 33 } 21 34 } 22 35 } -
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj
r3022 r3220 106 106 </Compile> 107 107 <Compile Include="UptimeCalendarDao.cs" /> 108 <Compile Include="VarBinaryStream.cs" /> 108 109 </ItemGroup> 109 110 <ItemGroup> -
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/JobDao.cs
r3018 r3220 60 60 Job job = Context.Jobs.SingleOrDefault(j => j.JobId.Equals(bObj.Id)); 61 61 DtoToEntity(bObj, job); 62 Context.SubmitChanges(); 62 try { 63 Context.SubmitChanges(); 64 } catch (ChangeConflictException cfe) { 65 66 } 63 67 } 64 68 … … 112 116 113 117 public Stream GetSerializedJobStream(Guid jobId) { 114 HiveDataContext hdc = new HiveDataContext();115 String ConnStr = hdc.Connection.ConnectionString;116 SqlConnection connection = new SqlConnection(hdc.Connection.ConnectionString);117 118 VarBinarySource source = 118 119 new VarBinarySource( 119 connection, null,120 (SqlConnection)Context.Connection, null, 120 121 "Job", "SerializedJob", "JobId", jobId); 121 122 -
trunk/sources/HeuristicLab.Hive.Server/3.2/ServiceCallInterception.cs
r3203 r3220 9 9 10 10 namespace HeuristicLab.Hive.Server { 11 class ServiceCallInterception: IMethodInterceptor { 12 #region IMethodInterceptor Members 11 internal class ServiceCallInterception : IMethodInterceptor { 12 13 private bool useTransactions = false; 13 14 14 15 public object Invoke(IMethodInvocation invocation) { 15 Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Entering Method " + invocation.Method.Name); 16 Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Entering Method " + 17 invocation.Method.Name); 16 18 17 Object obj; 18 19 using (TransactionScope scope = new TransactionScope()) { 19 if(ContextFactory.Context != null) { 20 Console.WriteLine("Error - Not null context found - why wasn't this disposed?"); 21 ContextFactory.Context = null; 22 } 23 24 Object obj = null; 25 26 if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) { 27 ContextFactory.Context.Connection.Open(); 28 if(useTransactions) 29 ContextFactory.Context.Transaction = ContextFactory.Context.Connection.BeginTransaction(); 20 30 try { 21 31 obj = invocation.Proceed(); 22 scope.Complete(); 23 } finally { 32 Console.WriteLine("leaving context open for Streaming"); 33 } 34 catch (Exception e) { 35 Console.WriteLine(e); 24 36 ContextFactory.Context.Dispose(); 25 Console.WriteLine("setting old context null");26 37 ContextFactory.Context = null; 27 Console.WriteLine("Disposing old Context"); 38 } 39 } else { 40 if(useTransactions) { 41 using (TransactionScope scope = new TransactionScope()) { 42 try { 43 obj = invocation.Proceed(); 44 scope.Complete(); 45 } 46 catch (Exception e) { 47 Console.WriteLine("Exception Occured"); 48 Console.WriteLine(e); 49 } 50 finally { 51 ContextFactory.Context.Dispose(); 52 Console.WriteLine("setting old context null"); 53 ContextFactory.Context = null; 54 Console.WriteLine("Disposing old Context"); 55 } 56 } 57 } else { 58 try { 59 obj = invocation.Proceed(); 60 } 61 catch (Exception e) { 62 Console.WriteLine("Exception Occured"); 63 Console.WriteLine(e); 64 } 65 finally { 66 ContextFactory.Context.Dispose(); 67 Console.WriteLine("setting old context null"); 68 ContextFactory.Context = null; 69 Console.WriteLine("Disposing old Context"); 70 } 28 71 } 29 } 30 Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Leaving Method " + invocation.Method.Name); 72 } 73 Console.WriteLine(DateTime.Now + " - " + Thread.CurrentThread.ManagedThreadId + " - Leaving Method " + 74 invocation.Method.Name); 75 31 76 return obj; 32 77 } 33 34 #endregion35 78 } 36 79 } 80 81
Note: See TracChangeset
for help on using the changeset viewer.