Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/11 15:32:27 (13 years ago)
Author:
cneumuel
Message:

#1233

  • added GetPlugin service method
  • fixed minor issues with double plugins in database
  • worked on HiveEngine
  • fixed wrong role name for Hive User
  • fixed bug in group assignment of slaves
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r5793 r6000  
    250250          dao.AddSlave(slaveInfo);
    251251        } else {
    252           dao.UpdateSlave(slaveInfo);
     252          var dbSlave = dao.GetSlave(slaveInfo.Id);
     253
     254          dbSlave.Name = slaveInfo.Name;
     255          dbSlave.Description = slaveInfo.Description;
     256
     257          dbSlave.Cores = slaveInfo.Cores;
     258          dbSlave.CpuArchitecture = slaveInfo.CpuArchitecture;
     259          dbSlave.CpuSpeed = slaveInfo.CpuSpeed;
     260          dbSlave.FreeCores = slaveInfo.FreeCores;
     261          dbSlave.FreeMemory = slaveInfo.FreeMemory;
     262          dbSlave.Memory = slaveInfo.Memory;
     263          dbSlave.OperatingSystem = slaveInfo.OperatingSystem;
     264         
     265          dbSlave.LastHeartbeat = DateTime.Now;         
     266          dbSlave.SlaveState = SlaveState.Idle;
     267
     268          // don't update those properties:
     269          // dbSlave.IsAllowedToCalculate = slaveInfo.IsAllowedToCalculate;
     270          // dbSlave.ParentResourceId = slaveInfo.ParentResourceId;
     271
     272          dao.UpdateSlave(dbSlave);
    253273        }
    254274      });
     
    282302        plugin.UserId = auth.UserId;
    283303        plugin.DateCreated = DateTime.Now;
     304        if (!plugin.IsLocal) {
     305          var existing = dao.GetPlugins(x => x.Name == plugin.Name && x.Version == plugin.Version.ToString() && !x.IsLocal);
     306          if (existing.Count() > 0) {
     307            // a plugin with the same name and version already exists.
     308            throw new FaultException<PluginAlreadyExistsFault>(new PluginAlreadyExistsFault(existing.Single().Id));
     309          }
     310        }
    284311        Guid pluginId = dao.AddPlugin(plugin);
    285312        foreach (PluginData pluginData in pluginDatas) {
     
    289316        return pluginId;
    290317      });
     318    }
     319
     320    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     321    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     322    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     323    public Plugin GetPlugin(Guid pluginId) {
     324      return dao.GetPlugin(pluginId);
    291325    }
    292326
Note: See TracChangeset for help on using the changeset viewer.