Changeset 4263 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3
- Timestamp:
- 08/19/10 12:41:05 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Authorization/HivePermissionManager.cs
r4253 r4263 11 11 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 12 12 using System.ServiceModel; 13 using HeuristicLab.Hive.Contracts.ResponseObjects; 13 14 14 15 namespace HeuristicLab.Hive.Server.Core { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DefaultScheduler.cs
r4254 r4263 31 31 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { 32 32 ClientDto slave = DaoLocator.ClientDao.FindById(slaveId); 33 LinkedList<JobDto> allOfflineJobsForSlave = 34 new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave(State.Offline, slave.NrOfFreeCores, slave.FreeMemory, slave.Id)); 33 LinkedList<JobDto> allOfflineJobsForSlave = new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave(State.Offline, slave.NrOfFreeCores, slave.FreeMemory, slave.Id)); 35 34 if (allOfflineJobsForSlave != null && allOfflineJobsForSlave.Count > 0) { 36 35 jobToCalculate = allOfflineJobsForSlave.First.Value; -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/ExecutionEngineFacade.cs
r4170 r4263 28 28 using HeuristicLab.Hive.Contracts.BusinessObjects; 29 29 using HeuristicLab.Hive.Server.DataAccess; 30 using HeuristicLab.Hive.Contracts.ResponseObjects; 30 31 31 32 namespace HeuristicLab.Hive.Server.Core { … … 60 61 public ResponseObject<SerializedJob> GetLastSerializedResult(Guid jobId, bool requested, bool snapshot) { 61 62 using (contextFactory.GetContext(false)) { 62 return jobManager.GetLastSerialized JobResultOf(jobId, requested, snapshot);63 return jobManager.GetLastSerializedResult(jobId, requested, snapshot); 63 64 } 64 65 } … … 77 78 78 79 79 public ResponseObject<JobResultList> Get AllJobResults(IEnumerable<Guid> jobIds) {80 public ResponseObject<JobResultList> GetJobResults(IEnumerable<Guid> jobIds) { 80 81 using (contextFactory.GetContext(false)) { 81 return jobManager.Get AllJobResults(jobIds);82 return jobManager.GetJobResults(jobIds); 82 83 } 83 84 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/ServerConsoleFacade.cs
r4253 r4263 31 31 using System.ServiceModel; 32 32 using HeuristicLab.Hive.Server.DataAccess; 33 using HeuristicLab.Hive.Contracts.ResponseObjects; 33 34 34 35 … … 53 54 sessionID = secMan.Login(username, password); 54 55 if (sessionID == Guid.Empty) { 55 resp.Success = false; 56 resp.StatusMessage = ApplicationConstants.RESPONSE_SERVERCONSOLE_LOGIN_FAILED; 57 } else { 58 resp.Success = true; 59 resp.StatusMessage = 60 ApplicationConstants.RESPONSE_SERVERCONSOLE_LOGIN_SUCCESS; 56 resp.StatusMessage = ResponseStatus.Login_LoginFaild; 61 57 } 62 58 return resp; … … 64 60 65 61 66 public ResponseList<ClientDto> GetAll Clients() {62 public ResponseList<ClientDto> GetAllSlaves() { 67 63 using (contextFactory.GetContext(false)) { 68 64 secMan.Authorize("AccessClients", sessionID, Guid.Empty); 69 return slaveManager.GetAll Clients();65 return slaveManager.GetAllSlaves(); 70 66 } 71 67 } … … 140 136 } 141 137 142 public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { 138 //public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { 139 // using (contextFactory.GetContext(false)) { 140 // secMan.Authorize("AccessJobResults", sessionID, jobId); 141 // return jobManager.GetLastJobResultOf(jobId); 142 // } 143 //} 144 145 public ResponseObject<SerializedJob> GetLastSerializedResult(Guid jobId, bool requested, bool snapshot) { 143 146 using (contextFactory.GetContext(false)) { 144 147 secMan.Authorize("AccessJobResults", sessionID, jobId); 145 return jobManager.GetLastJobResultOf(jobId); 146 } 147 } 148 149 public ResponseObject<SerializedJob> GetLastSerializedJobResultOf(Guid jobId, bool requested, bool snapshot) { 150 using (contextFactory.GetContext(false)) { 151 secMan.Authorize("AccessJobResults", sessionID, jobId); 152 return jobManager.GetLastSerializedJobResultOf(jobId, requested, snapshot); 153 } 154 } 155 156 public ResponseObject<JobResultList> GetAllJobResults(IEnumerable<Guid> jobIds) { 148 return jobManager.GetLastSerializedResult(jobId, requested, snapshot); 149 } 150 } 151 152 public ResponseObject<JobResultList> GetJobResults(IEnumerable<Guid> jobIds) { 157 153 using (contextFactory.GetContext(false)) { 158 154 //secMan.Authorize("AccessJobResults", sessionID, jobId); skip authorization 159 return jobManager.Get AllJobResults(jobIds);160 } 161 } 162 163 public Response RemoveJob(Guid jobId) {164 using (contextFactory.GetContext()) {165 secMan.Authorize("RemoveJob", sessionID, jobId);166 return jobManager.RemoveJob(jobId);167 }168 }155 return jobManager.GetJobResults(jobIds); 156 } 157 } 158 159 //public Response RemoveJob(Guid jobId) { 160 // using (contextFactory.GetContext()) { 161 // secMan.Authorize("RemoveJob", sessionID, jobId); 162 // return jobManager.RemoveJob(jobId); 163 // } 164 //} 169 165 170 166 public Response RequestSnapshot(Guid jobId) { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/SlaveFacade.cs
r4254 r4263 35 35 using HeuristicLab.Hive.Server.LINQDataAccess; 36 36 using HeuristicLab.Hive.Server.DataAccess; 37 using HeuristicLab.Hive.Contracts.ResponseObjects; 37 38 38 39 namespace HeuristicLab.Hive.Server.Core { … … 85 86 } 86 87 87 public ResponseList<CachedHivePluginInfoDto> SendPlugins(List<HivePluginInfoDto> pluginList) {88 return slaveCommunicator. SendPlugins(pluginList);88 public ResponseList<CachedHivePluginInfoDto> GetPlugins(List<HivePluginInfoDto> pluginList) { 89 return slaveCommunicator.GetPlugins(pluginList); 89 90 } 90 91 … … 94 95 } 95 96 } 96 97 97 98 98 public ResponseCalendar GetCalendar(Guid clientId) { … … 114 114 /// Do not use automatic transactions here 115 115 /// </summary> 116 public Stream SendStreamedJob(Guid clientId) {116 public Stream GetStreamedJob(Guid clientId) { 117 117 using (contextFactory.GetContext(false)) { 118 118 MultiStream stream = new MultiStream(); … … 125 125 stream.AddStream(new StreamedObject<ResponseObject<JobDto>>(job)); 126 126 127 IJobManager jobManager = ServiceLocator.GetJobManager(); 128 IInternalJobManager internalJobManager = (IInternalJobManager)jobManager; 127 IInternalJobManager internalJobManager = (IInternalJobManager)ServiceLocator.GetJobManager(); 129 128 130 129 //second stream the job binary data 131 130 MemoryStream memoryStream = new MemoryStream(); 132 if (job.Obj != null) 131 if (job.Obj != null) { 133 132 stream.AddStream(new MemoryStream(internalJobManager.GetSerializedJobDataById(job.Obj.Id))); 133 } 134 134 135 135 OperationContext clientContext = OperationContext.Current; … … 144 144 } 145 145 146 public Stream SendStreamedPlugins(List<HivePluginInfoDto> pluginList) {147 return new StreamedObject<ResponseList<CachedHivePluginInfoDto>>(this. SendPlugins(pluginList));146 public Stream GetStreamedPlugins(List<HivePluginInfoDto> pluginList) { 147 return new StreamedObject<ResponseList<CachedHivePluginInfoDto>>(this.GetPlugins(pluginList)); 148 148 } 149 149 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/InternalInterfaces/IInternalSlaveCommunicator.cs
r4253 r4263 27 27 using HeuristicLab.Hive.Contracts; 28 28 using System.IO; 29 using HeuristicLab.Hive.Contracts.ResponseObjects; 29 30 30 31 namespace HeuristicLab.Hive.Server.Core.InternalInterfaces { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/JobManager.cs
r4254 r4263 38 38 using HeuristicLab.Hive.Server.LINQDataAccess; 39 39 using IsolationLevel = System.Transactions.IsolationLevel; 40 using HeuristicLab.Hive.Contracts.ResponseObjects; 40 41 41 42 namespace HeuristicLab.Hive.Server.Core { … … 50 51 lifecycleManager.RegisterStartup(new EventHandler(lifecycleManager_OnStartup)); 51 52 lifecycleManager.RegisterShutdown(new EventHandler(lifecycleManager_OnShutdown)); 52 }53 54 private JobDto GetLastJobResult(Guid jobId) {55 return DaoLocator.JobDao.FindById(jobId);56 53 } 57 54 … … 85 82 public ResponseList<JobDto> GetAllJobs() { 86 83 ResponseList<JobDto> response = new ResponseList<JobDto>(); 87 88 84 response.List = new List<JobDto>(DaoLocator.JobDao.FindAll()); 89 response.Success = true;90 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ALL_JOBS;91 92 85 return response; 93 86 } … … 96 89 ResponseList<JobDto> response = new ResponseList<JobDto>(); 97 90 response.List = new List<JobDto>(DaoLocator.JobDao.FindWithLimitations(jobState, offset, count)); 98 response.Success = true;99 91 return response; 100 92 } … … 118 110 response.Obj = DaoLocator.JobDao.FindById(jobId); 119 111 if (response.Obj != null) { 120 response.Success = true; 121 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_GET_JOB_BY_ID; 112 response.StatusMessage = ResponseStatus.Ok; 122 113 } else { 123 response.Success = false; 124 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 114 response.StatusMessage = ResponseStatus.GetJobById_JobDoesNotExist; 125 115 } 126 116 … … 135 125 job.Obj = DaoLocator.JobDao.FindById(jobId); 136 126 if (job.Obj != null) { 137 job.Success = true; 138 job.StatusMessage = ApplicationConstants.RESPONSE_JOB_GET_JOB_BY_ID; 127 job.StatusMessage = ResponseStatus.Ok; 139 128 140 129 job.Obj.Client = DaoLocator.ClientDao.GetClientForJob(jobId); 141 130 } else { 142 job.Success = false; 143 job.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 131 job.StatusMessage = ResponseStatus.GetJobByIdWithDetails_JobDoesNotExist; 144 132 } 145 133 return job; … … 166 154 if (job != null && job.JobInfo != null) { 167 155 if (job.JobInfo.State != State.Offline) { 168 response.Success = false; 169 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE; 156 response.StatusMessage = ResponseStatus.AddNewJob_JobStateMustBeOffline; 170 157 return response; 171 158 } 172 159 if (job.JobInfo.Id != Guid.Empty) { 173 response.Success = false; 174 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ID_MUST_NOT_BE_SET; 160 response.StatusMessage = ResponseStatus.AddNewJob_JobIdMustNotBeSet; 175 161 return response; 176 162 } 177 163 if (job.SerializedJobData == null) { 178 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_NULL; 179 response.Success = false; 164 response.StatusMessage = ResponseStatus.AddNewJob_JobNull; 180 165 return response; 181 166 } … … 185 170 DaoLocator.PluginInfoDao.InsertPluginDependenciesForJob(job.JobInfo); 186 171 187 response.Success = true;188 172 response.Obj = job.JobInfo; 189 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_ADDED;190 173 } else { 191 response.Success = false; 192 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_NULL; 174 response.StatusMessage = ResponseStatus.AddNewJob_JobNull; 193 175 } 194 176 … … 198 180 /// <summary> 199 181 /// Removes a job from the database 182 /// 183 /// [chn] this is currently not used anywhere -> check redundancy with AbortJob 200 184 /// </summary> 201 185 /// <param name="jobId"></param> 202 186 /// <returns></returns> 203 public Response RemoveJob(Guid jobId) { 204 Response response = new Response(); 205 206 JobDto job = DaoLocator.JobDao.FindById(jobId); 207 if (job == null) { 208 response.Success = false; 209 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 210 return response; 211 } 212 DaoLocator.JobDao.Delete(job); 213 response.Success = false; 214 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_REMOVED; 215 216 return response; 217 } 218 219 public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { 220 ResponseObject<JobDto> result = new ResponseObject<JobDto>(); 221 222 result.Obj = GetLastJobResult(jobId); 223 result.Success = result.Obj != null; 224 225 return result; 226 } 187 //public Response RemoveJob(Guid jobId) { 188 // Response response = new Response(); 189 190 // JobDto job = DaoLocator.JobDao.FindById(jobId); 191 // if (job == null) { 192 // response.StatusMessage = ResponseStatusMessage.RemoveJob_JobDoesNotExist; 193 // return response; 194 // } 195 // DaoLocator.JobDao.Delete(job); 196 197 // return response; 198 //} 199 200 /// 201 /// [chn] currently not used anywhere 202 /// 203 //public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { 204 // ResponseObject<JobDto> result = new ResponseObject<JobDto>(); 205 206 // result.Obj = DaoLocator.JobDao.FindById(jobId); 207 // if (result.Obj == null) { 208 // result.StatusMessage = ResponseStatusMessage. 209 // } 210 211 // return result; 212 //} 227 213 228 214 // [chn] [refactor] why does this method handle 3 different cases? wouldn't 3 methods be easier? … … 230 216 // requested==true: resultat mit job 231 217 // requested==false: 232 public ResponseObject<SerializedJob> GetLastSerialized JobResultOf(Guid jobId, bool requested, bool snapshot) {218 public ResponseObject<SerializedJob> GetLastSerializedResult(Guid jobId, bool requested, bool snapshot) { 233 219 ResponseObject<SerializedJob> response = new ResponseObject<SerializedJob>(); 234 220 … … 237 223 //if it's a snapshot but the result hasn't reached the server yet... 238 224 if (snapshot && (job.State == State.RequestSnapshot || job.State == State.RequestSnapshotSent)) { 239 response.Success = true; 240 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE; 225 response.StatusMessage = ResponseStatus.GetLastSerializedResult_JobResultNotYetThere; 241 226 242 227 return response; … … 245 230 //if it's NOT a snapshot, NEITHER request NOR is it finished 246 231 if (!requested && !snapshot && job.State != State.Finished) { 247 response.Success = true; 248 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE; 232 response.StatusMessage = ResponseStatus.GetLastSerializedResult_JobResultNotYetThere; 249 233 250 234 return response; … … 252 236 253 237 //every other case - snapshot, job finished or it's requested 254 response.Success = true;255 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT;256 238 response.Obj = new SerializedJob(); 257 239 response.Obj.JobInfo = job; … … 267 249 JobDto job = DaoLocator.JobDao.FindById(jobId); 268 250 if (job.State == State.RequestSnapshot || job.State == State.RequestSnapshotSent) { 269 response.Success = true; 270 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_ALLREADY_SET; 251 response.StatusMessage = ResponseStatus.RequestSnapshot_SnapshotAlreadyRequested; 271 252 return response; 272 253 } 273 254 if (job.State != State.Calculating) { 274 response.Success = false; 275 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; 255 response.StatusMessage = ResponseStatus.RequestSnapshot_JobIsNotBeeingCalculated; 276 256 return response; 277 257 } … … 280 260 DaoLocator.JobDao.Update(job); 281 261 282 re sponse.Success = true;283 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_SET;284 285 return response;286 }287 262 return response; 263 } 264 265 /// <summary> 266 /// [chn] rename to RequestAbortJob? 267 /// </summary> 288 268 public Response AbortJob(Guid jobId) { 289 269 Response response = new Response(); … … 291 271 JobDto job = DaoLocator.JobDao.FindById(jobId); 292 272 if (job == null) { 293 response.Success = false;294 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST;273 //response.Success = false; 274 response.StatusMessage = ResponseStatus.AbortJob_JobDoesNotExist; 295 275 return response; // no commit needed 296 276 } 297 277 if (job.State == State.Abort) { 298 response.Success = true;299 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_ALLREADY_SET;278 //response.Success = true; 279 response.StatusMessage = ResponseStatus.AbortJob_AbortAlreadyRequested; 300 280 return response; // no commit needed 301 281 } 302 282 if (job.State != State.Calculating && job.State != State.RequestSnapshot && job.State != State.RequestSnapshotSent) { 303 response.Success = false;304 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED;283 //response.Success = false; 284 response.StatusMessage = ResponseStatus.AbortJob_JobIsNotBeeingCalculated; 305 285 return response; // no commit needed 306 286 } … … 309 289 DaoLocator.JobDao.Update(job); 310 290 311 response.Success = true;312 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_SET;313 314 291 return response; 315 292 } … … 320 297 /// <param name="jobIds"></param> 321 298 /// <returns></returns> 322 public ResponseObject<JobResultList> Get AllJobResults(IEnumerable<Guid> jobIds) {299 public ResponseObject<JobResultList> GetJobResults(IEnumerable<Guid> jobIds) { 323 300 ResponseObject<JobResultList> response = new ResponseObject<JobResultList>(); 324 301 JobResultList jobResultList = new JobResultList(); … … 335 312 } 336 313 response.Obj = jobResultList; 337 response.Success = true;338 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ALL_JOBS;339 314 return response; 340 315 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/SlaveCommunicator.cs
r4254 r4263 33 33 using HeuristicLab.PluginInfrastructure; 34 34 using HeuristicLab.Tracing; 35 using HeuristicLab.Hive.Contracts.ResponseObjects; 35 36 36 37 namespace HeuristicLab.Hive.Server.Core { … … 168 169 /// A hearbeat entry is created as well (login is the first hearbeat) 169 170 /// </summary> 170 /// <param name=" clientInfo"></param>171 /// <param name="slaveInfo"></param> 171 172 /// <returns></returns> 172 public Response Login(ClientDto clientInfo) {173 public Response Login(ClientDto slaveInfo) { 173 174 Response response = new Response(); 174 175 175 176 heartbeatLock.EnterWriteLock(); 176 if (lastHeartbeats.ContainsKey( clientInfo.Id)) {177 lastHeartbeats[ clientInfo.Id] = DateTime.Now;177 if (lastHeartbeats.ContainsKey(slaveInfo.Id)) { 178 lastHeartbeats[slaveInfo.Id] = DateTime.Now; 178 179 } else { 179 lastHeartbeats.Add( clientInfo.Id, DateTime.Now);180 lastHeartbeats.Add(slaveInfo.Id, DateTime.Now); 180 181 } 181 182 heartbeatLock.ExitWriteLock(); 182 183 183 ClientDto dbClient = DaoLocator.ClientDao.FindById( clientInfo.Id);184 ClientDto dbClient = DaoLocator.ClientDao.FindById(slaveInfo.Id); 184 185 185 186 //Really set offline? 186 187 //Reconnect issues with the currently calculating jobs 187 clientInfo.State = State.Idle;188 clientInfo.CalendarSyncStatus = dbClient != null ? dbClient.CalendarSyncStatus : CalendarState.NotAllowedToFetch;188 slaveInfo.State = State.Idle; 189 slaveInfo.CalendarSyncStatus = dbClient != null ? dbClient.CalendarSyncStatus : CalendarState.NotAllowedToFetch; 189 190 190 191 if (dbClient == null) 191 DaoLocator.ClientDao.Insert( clientInfo);192 DaoLocator.ClientDao.Insert(slaveInfo); 192 193 else 193 DaoLocator.ClientDao.Update(clientInfo); 194 response.Success = true; 195 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGIN_SUCCESS; 194 DaoLocator.ClientDao.Update(slaveInfo); 195 196 196 return response; 197 197 } … … 202 202 ClientDto client = DaoLocator.ClientDao.FindById(clientId); 203 203 if (client == null) { 204 response.Success = false;205 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND;204 //response.Success = false; 205 response.StatusMessage = ResponseStatus.GetCalendar_ResourceNotFound; 206 206 return response; 207 207 } … … 211 211 IEnumerable<AppointmentDto> appointments = DaoLocator.UptimeCalendarDao.GetCalendarForClient(client); 212 212 if (appointments.Count() == 0) { 213 response.StatusMessage = ApplicationConstants.RESPONSE_UPTIMECALENDAR_NO_CALENDAR_FOUND;214 response.Success = false;213 response.StatusMessage = ResponseStatus.GetCalendar_NoCalendarFound; 214 //response.Success = false; 215 215 } else { 216 response.Success = true;216 //response.Success = true; 217 217 response.Appointments = appointments; 218 218 } … … 227 227 ClientDto client = DaoLocator.ClientDao.FindById(clientId); 228 228 if (client == null) { 229 response.Success = false;230 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND;229 //response.Success = false; 230 response.StatusMessage = ResponseStatus.GetCalendar_ResourceNotFound; 231 231 return response; 232 232 } … … 234 234 client.CalendarSyncStatus = state; 235 235 DaoLocator.ClientDao.Update(client); 236 237 response.Success = true;238 response.StatusMessage = ApplicationConstants.RESPONSE_UPTIMECALENDAR_STATUS_UPDATED;239 236 240 237 return response; … … 259 256 // check if the client is logged in 260 257 if (client.State == State.Offline || client.State == State.NullState) { 261 response.Success = false;262 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_USER_NOT_LOGGED_IN;258 // response.Success = false; 259 response.StatusMessage = ResponseStatus.ProcessHeartBeat_UserNotLoggedIn; 263 260 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage)); 264 261 … … 288 285 //check if new Cal must be loaded 289 286 if (client.CalendarSyncStatus == CalendarState.Fetch || client.CalendarSyncStatus == CalendarState.ForceFetch) { 290 response.Success = true;291 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_FETCH_OR_FORCEFETCH_CALENDAR;292 287 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.FetchOrForceFetchCalendar)); 293 288 … … 306 301 } 307 302 Logger.Debug(" END Looked for Client Jobs"); 308 response.Success = true;309 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HEARTBEAT_RECEIVED;310 303 311 304 DaoLocator.ClientDao.Update(client); … … 347 340 if (hbData.JobProgress != null && hbData.JobProgress.Count > 0) { 348 341 if (jobsOfClient == null || jobsOfClient.Count == 0) { 349 response.Success = false;350 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED;342 //response.Success = false; 343 //response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 351 344 352 345 foreach (Guid jobId in hbData.JobProgress.Keys) { … … 362 355 curJob.Client = DaoLocator.ClientDao.GetClientForJob(curJob.Id); 363 356 if (curJob.Client == null || curJob.Client.Id != hbData.SlaveId) { 364 response.Success = false;365 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED;357 //response.Success = false; 358 //response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 366 359 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id)); 367 360 Logger.Error("There is no job calculated by this user " + hbData.SlaveId + " Job: " + curJob); … … 439 432 response.Obj = job2Calculate; 440 433 response.Obj.PluginsNeeded = DaoLocator.PluginInfoDao.GetPluginDependenciesForJob(response.Obj); 441 response.Success = true; 434 442 435 Logger.Info("Job pulled: " + job2Calculate + " for user " + clientId); 443 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED;444 436 lock (newAssignedJobs) { 445 437 if (!newAssignedJobs.ContainsKey(job2Calculate.Id)) … … 447 439 } 448 440 } else { 449 response.Success = false;441 //response.Success = false; 450 442 response.Obj = null; 451 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT;443 response.StatusMessage = ResponseStatus.GetJob_NoJobsAvailable; 452 444 Logger.Info("No more Jobs left for " + clientId); 453 445 } … … 473 465 ResponseResultReceived response = ProcessJobResult(result.ClientId, result.JobId, new byte[] { }, result.Percentage, result.Exception, finished); 474 466 475 if (response.S uccess) {467 if (response.StatusMessage == ResponseStatus.Ok) { 476 468 Logger.Debug("Trying to aquire WCF Job Stream"); 477 469 //jobStream = DaoLocator.JobDao.GetSerializedJobStream(result.JobId); … … 500 492 } 501 493 502 503 private ResponseResultReceived ProcessJobResult(Guid clientId, 504 Guid jobId, 505 byte[] result, 506 double? percentage, 507 string exception, 508 bool finished) { 509 494 private ResponseResultReceived ProcessJobResult(Guid clientId, Guid jobId, byte[] result, double? percentage, string exception, bool finished) { 510 495 Logger.Info("BEGIN Job received for Storage - SUB method: " + jobId); 511 496 … … 521 506 } 522 507 } 523 508 524 509 if (job != null && job.JobInfo == null) { 525 response.Success = false;526 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOB_WITH_THIS_ID;510 //response.Success = false; 511 response.StatusMessage = ResponseStatus.ProcessJobResult_JobDoesNotExist; 527 512 response.JobId = jobId; 528 513 Logger.Error("No job with Id " + jobId); … … 532 517 } 533 518 if (job.JobInfo.State == State.Abort) { 534 response.Success = false;535 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_WAS_ABORTED;519 //response.Success = false; 520 response.StatusMessage = ResponseStatus.ProcessJobResult_JobAborted; 536 521 537 522 Logger.Error("Job was aborted! " + job.JobInfo); … … 541 526 } 542 527 if (job.JobInfo.Client == null) { 543 response.Success = false;544 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED;528 //response.Success = false; 529 response.StatusMessage = ResponseStatus.ProcessJobResult_JobIsNotBeeingCalculated; 545 530 response.JobId = jobId; 546 531 … … 551 536 } 552 537 if (job.JobInfo.Client.Id != clientId) { 553 response.Success = false;554 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_WRONG_CLIENT_FOR_JOB;538 //response.Success = false; 539 response.StatusMessage = ResponseStatus.ProcessJobResult_WrongClientForJob; 555 540 response.JobId = jobId; 556 541 … … 561 546 } 562 547 if (job.JobInfo.State == State.Finished) { 563 response.Success = true; 564 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED; 548 response.StatusMessage = ResponseStatus.Ok; 565 549 response.JobId = jobId; 566 550 … … 574 558 job.JobInfo.State = State.Calculating; 575 559 } 576 if (job.JobInfo.State != State.Calculating && 577 job.JobInfo.State != State.Pending) { 578 response.Success = false; 579 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_WRONG_JOB_STATE; 560 if (job.JobInfo.State != State.Calculating && job.JobInfo.State != State.Pending) { 561 //response.Success = false; 562 response.StatusMessage = ResponseStatus.ProcessJobResult_InvalidJobState; 580 563 response.JobId = jobId; 581 564 … … 600 583 DaoLocator.JobDao.Update(job.JobInfo); 601 584 602 response.Success = true; 603 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED; 585 response.StatusMessage = ResponseStatus.Ok; 604 586 response.JobId = jobId; 605 587 response.Finished = finished; … … 652 634 ClientDto client = DaoLocator.ClientDao.FindById(clientId); 653 635 if (client == null) { 654 response.Success = false;655 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGOUT_CLIENT_NOT_REGISTERED;636 //response.Success = false; 637 response.StatusMessage = ResponseStatus.Logout_SlaveNotRegistered; 656 638 return response; 657 639 } … … 668 650 DaoLocator.ClientDao.Update(client); 669 651 670 response.Success = true;671 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGOUT_SUCCESS;672 673 652 return response; 674 653 } … … 684 663 JobDto job = DaoLocator.JobDao.FindById(jobId); 685 664 if (job == null) { 686 response.Success = false;687 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_DOESNT_EXIST;665 //response.Success = false; 666 response.StatusMessage = ResponseStatus.IsJobStillNeeded_JobDoesNotExist; 688 667 Logger.Error("Job doesn't exist (anymore)! " + jobId); 689 668 return response; 690 669 } 691 670 if (job.State == State.Finished) { 692 response.Success = true;693 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_ALLREADY_FINISHED;671 //response.Success = true; 672 response.StatusMessage = ResponseStatus.IsJobStillNeeded_JobAlreadyFinished; 694 673 Logger.Error("already finished! " + job); 695 674 return response; … … 702 681 DaoLocator.JobDao.Update(job); 703 682 704 response.Success = true; 705 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_SEND_JOBRESULT; 706 return response; 707 } 708 709 public ResponseList<CachedHivePluginInfoDto> SendPlugins(List<HivePluginInfoDto> pluginList) { 683 return response; 684 } 685 686 public ResponseList<CachedHivePluginInfoDto> GetPlugins(List<HivePluginInfoDto> pluginList) { 710 687 ResponseList<CachedHivePluginInfoDto> response = new ResponseList<CachedHivePluginInfoDto>(); 688 response.List = new List<CachedHivePluginInfoDto>(); 711 689 foreach (HivePluginInfoDto pluginInfo in pluginList) { 712 690 if (pluginInfo.Update) { 713 691 //check if there is a newer version 714 IPluginDescription ipd = 715 ApplicationManager.Manager.Plugins.Where(pd => pd.Name == pluginInfo.Name && pd.Version.Major == pluginInfo.Version.Major && pd.Version.Minor == pluginInfo.Version.Minor && pd.Version.Revision > pluginInfo.Version.Revision).SingleOrDefault(); 692 IPluginDescription ipd = ApplicationManager.Manager.Plugins.Where(pd => pd.Name == pluginInfo.Name && pd.Version.Major == pluginInfo.Version.Major && pd.Version.Minor == pluginInfo.Version.Minor && pd.Version.Revision > pluginInfo.Version.Revision).SingleOrDefault(); 716 693 if (ipd != null) { 717 response.List.Add( convertPluginDescriptorToDto(ipd));694 response.List.Add(ConvertPluginDescriptorToDto(ipd)); 718 695 } 719 696 } else { 720 IPluginDescription ipd = 721 ApplicationManager.Manager.Plugins.Where(pd => pd.Name == pluginInfo.Name && pd.Version.Major == pluginInfo.Version.Major && pd.Version.Minor == pluginInfo.Version.Minor && pd.Version.Revision >= pluginInfo.Version.Revision).SingleOrDefault(); 697 IPluginDescription ipd = ApplicationManager.Manager.Plugins.Where(pd => pd.Name == pluginInfo.Name && pd.Version.Major == pluginInfo.Version.Major && pd.Version.Minor == pluginInfo.Version.Minor && pd.Version.Revision >= pluginInfo.Version.Revision).SingleOrDefault(); 722 698 if (ipd != null) { 723 response.List.Add( convertPluginDescriptorToDto(ipd));699 response.List.Add(ConvertPluginDescriptorToDto(ipd)); 724 700 } else { 725 response.Success = false;726 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_PLUGINS_NOT_AVAIL;701 //response.Success = false; 702 response.StatusMessage = ResponseStatus.GetPlugins_PluginsNotAvailable; 727 703 return response; 728 704 } 729 705 } 730 706 } 731 response.Success = true; 732 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_PLUGINS_SENT; 733 734 return response; 735 } 736 737 private CachedHivePluginInfoDto convertPluginDescriptorToDto(IPluginDescription currPlugin) { 707 return response; 708 } 709 710 private CachedHivePluginInfoDto ConvertPluginDescriptorToDto(IPluginDescription currPlugin) { 738 711 CachedHivePluginInfoDto currCachedPlugin = new CachedHivePluginInfoDto { 739 712 Name = currPlugin.Name, -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/SlaveManager.cs
r4253 r4263 33 33 using HeuristicLab.Hive.Server.LINQDataAccess; 34 34 using ClientGroup=HeuristicLab.Hive.Contracts.BusinessObjects.ClientGroupDto; 35 using HeuristicLab.Hive.Contracts.ResponseObjects; 35 36 36 37 namespace HeuristicLab.Hive.Server.Core { … … 48 49 /// </summary> 49 50 /// <returns></returns> 50 public ResponseList<ClientDto> GetAll Clients() {51 public ResponseList<ClientDto> GetAllSlaves() { 51 52 ResponseList<ClientDto> response = new ResponseList<ClientDto>(); 52 53 53 response.List = new List<ClientDto>(DaoLocator.ClientDao.FindAll()); 54 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_GET_ALL_CLIENTS;55 response.Success = true;56 57 54 return response; 58 55 } … … 65 62 ResponseList<ClientGroup> response = new ResponseList<ClientGroup>(); 66 63 67 List<ClientGroup> allClientGroups = 68 new List<ClientGroup>(DaoLocator.ClientGroupDao.FindAllWithSubGroupsAndClients()); 64 List<ClientGroup> allClientGroups = new List<ClientGroup>(DaoLocator.ClientGroupDao.FindAllWithSubGroupsAndClients()); 69 65 ClientGroup emptyClientGroup = new ClientGroup(); 70 66 IEnumerable<ClientDto> groupLessClients = DaoLocator.ClientDao.FindAllClientsWithoutGroup(); … … 78 74 79 75 response.List = allClientGroups; 80 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_GET_ALL_CLIENTGROUPS;81 response.Success = true;82 76 83 77 return response; 84 78 } 85 79 80 /// <summary> 81 /// [chn] check usage 82 /// </summary> 86 83 public ResponseList<UpTimeStatisticsDto> GetAllUpTimeStatistics() { 87 ResponseList<UpTimeStatisticsDto> response = new ResponseList<UpTimeStatisticsDto>(); 88 response.Success = true; 89 return response; 84 return new ResponseList<UpTimeStatisticsDto>(); 90 85 } 91 86 … … 99 94 100 95 if (clientGroup.Id != Guid.Empty) { 101 response.Success = false;102 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_ID_MUST_NOT_BE_SET;96 //response.Success = false; 97 response.StatusMessage = ResponseStatus.AddClientGroup_SlaveIdMustNotBeSet; 103 98 } 104 99 else { … … 106 101 //clientGroupAdapter.Update(clientGroup); 107 102 response.Obj = clientGroup; 108 response.Success = true;109 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_ADDED;110 103 } 111 104 … … 124 117 ClientGroup clientGroup = DaoLocator.ClientGroupDao.FindById(clientGroupId); 125 118 if (clientGroup == null) { 126 response.Success = false;127 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST;119 //response.Success = false; 120 response.StatusMessage = ResponseStatus.AddResourceToGroup_SlaveGroupDoesNotExist; 128 121 return response; 129 122 } … … 138 131 DaoLocator.ClientDao.SetServerSideCalendar(dbr, clientGroup.Id); 139 132 } 140 141 response.Success = true;142 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_ADDED_TO_GROUP;143 133 144 134 return response; … … 156 146 ClientGroup clientGroup = DaoLocator.ClientGroupDao.FindById(clientGroupId); 157 147 if (clientGroup == null) { 158 response.Success = false;159 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST;148 // response.Success = false; 149 response.StatusMessage = ResponseStatus.AddResourceToGroup_SlaveGroupDoesNotExist; 160 150 return response; 161 151 } 162 152 163 153 DaoLocator.ClientGroupDao.RemoveRessourceFromClientGroup(resourceId, clientGroup.Id); 164 165 response.Success = true;166 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_REMOVED;167 154 return response; 168 155 } … … 175 162 ClientGroupDtoList groupsOfClient = new ClientGroupDtoList(DaoLocator.ClientGroupDao.MemberOf(client)); 176 163 response.Obj = groupsOfClient; 177 response.Success = true; 178 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_GET_GROUPS_OF_CLIENT; 179 } 180 else { 164 } else { 181 165 response.Obj = new ClientGroupDtoList(); 182 response.Success = false;183 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND;166 //response.Success = false; 167 response.StatusMessage = ResponseStatus.GetAllGroupsOfResource_ResourceNotFound; 184 168 } 185 169 … … 192 176 ClientGroup clientGroup = DaoLocator.ClientGroupDao.FindById(clientGroupId); 193 177 if (clientGroup == null) { 194 response.Success = false; 195 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST; 178 response.StatusMessage = ResponseStatus.DeleteClientGroup_SlaveGroupDoesNotExist; 196 179 return response; 197 180 } 198 181 199 182 DaoLocator.ClientGroupDao.Delete(clientGroup); 200 201 response.Success = true;202 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DELETED;203 183 return response; 204 184 } … … 207 187 ResponseList<AppointmentDto> response = new ResponseList<AppointmentDto>(); 208 188 response.List = new List<AppointmentDto>(DaoLocator.UptimeCalendarDao.GetUptimeCalendarForResource(guid)); 209 response.Success = true;210 189 return response; 211 190 } … … 214 193 DaoLocator.UptimeCalendarDao.SetUptimeCalendarForResource(guid, appointments); 215 194 DaoLocator.UptimeCalendarDao.NotifyClientsOfNewCalendar(guid, isForced); 216 return new Response {Success = true};195 return new Response(); 217 196 } 218 197 #endregion
Note: See TracChangeset
for help on using the changeset viewer.