Exemplo n.º 1
0
 public static DT.Slave ToDto(this DA.Slave source)
 {
     if (source == null)
     {
         return(null);
     }
     return(new DT.Slave {
         Id = source.ResourceId,
         ParentResourceId = source.ParentResourceId,
         Cores = source.Cores,
         CpuSpeed = source.CpuSpeed,
         FreeCores = source.FreeCores,
         FreeMemory = source.FreeMemory,
         IsAllowedToCalculate = source.IsAllowedToCalculate,
         Memory = source.Memory,
         Name = source.Name,
         SlaveState = source.SlaveState.ToDto(),
         CpuArchitecture = source.CpuArchitecture.ToDto(),
         OperatingSystem = source.OperatingSystem,
         LastHeartbeat = source.LastHeartbeat,
         CpuUtilization = source.CpuUtilization,
         HbInterval = source.HbInterval,
         IsDisposable = source.IsDisposable,
         OwnerUserId = source.OwnerUserId
     });
 }
Exemplo n.º 2
0
        public static DB.Slave ToEntity(DT.Slave source)
        {
            if (source == null)
            {
                return(null);
            }
            var entity = new DB.Slave(); ToEntity(source, entity);

            return(entity);
        }
Exemplo n.º 3
0
        public static DA.Slave ToEntity(this DT.Slave source)
        {
            if (source == null)
            {
                return(null);
            }
            var result = new DA.Slave();

            source.CopyToEntity(result);
            return(result);
        }
Exemplo n.º 4
0
        private void AssignTask(IPersistenceManager pm, DA.Slave slave, Guid taskId)
        {
            const DA.TaskState transferring = DA.TaskState.Transferring;
            DateTime           now          = DateTime.Now;
            var taskDao     = pm.TaskDao;
            var stateLogDao = pm.StateLogDao;

            pm.UseTransaction(() => {
                var task = taskDao.GetById(taskId);
                stateLogDao.Save(new DA.StateLog {
                    State     = transferring,
                    DateTime  = now,
                    TaskId    = taskId,
                    SlaveId   = slave.ResourceId,
                    UserId    = null,
                    Exception = null
                });
                task.State         = transferring;
                task.LastHeartbeat = now;
                pm.SubmitChanges();
            });
        }
Exemplo n.º 5
0
 public static void ToEntity(DT.Slave source, DB.Slave target)
 {
     if ((source != null) && (target != null))
     {
         target.ResourceId           = source.Id;
         target.ParentResourceId     = source.ParentResourceId;
         target.Cores                = source.Cores;
         target.CpuSpeed             = source.CpuSpeed;
         target.FreeCores            = source.FreeCores;
         target.FreeMemory           = source.FreeMemory;
         target.IsAllowedToCalculate = source.IsAllowedToCalculate;
         target.Memory               = source.Memory;
         target.Name            = source.Name;
         target.SlaveState      = Convert.ToEntity(source.SlaveState);
         target.CpuArchitecture = Convert.ToEntity(source.CpuArchitecture);
         target.OperatingSystem = source.OperatingSystem;
         target.LastHeartbeat   = source.LastHeartbeat;
         target.CpuUtilization  = source.CpuUtilization;
         target.HbInterval      = source.HbInterval;
         target.IsDisposable    = source.IsDisposable;
         target.OwnerUserId     = source.OwnerUserId;
     }
 }
Exemplo n.º 6
0
 public static void CopyToEntity(this DT.Slave source, DA.Slave target)
 {
     if ((source == null) || (target == null))
     {
         return;
     }
     target.ResourceId           = source.Id;
     target.ParentResourceId     = source.ParentResourceId;
     target.Cores                = source.Cores;
     target.CpuSpeed             = source.CpuSpeed;
     target.FreeCores            = source.FreeCores;
     target.FreeMemory           = source.FreeMemory;
     target.IsAllowedToCalculate = source.IsAllowedToCalculate;
     target.Memory               = source.Memory;
     target.Name            = source.Name;
     target.SlaveState      = source.SlaveState.ToEntity();
     target.CpuArchitecture = source.CpuArchitecture.ToEntity();
     target.OperatingSystem = source.OperatingSystem;
     target.LastHeartbeat   = source.LastHeartbeat;
     target.CpuUtilization  = source.CpuUtilization;
     target.HbInterval      = source.HbInterval;
     target.IsDisposable    = source.IsDisposable;
     target.OwnerUserId     = source.OwnerUserId;
 }
Exemplo n.º 7
0
 public static DB.Slave ToEntity(DT.Slave source) {
   if (source == null) return null;
   var entity = new DB.Slave(); ToEntity(source, entity);
   return entity;
 }
Exemplo n.º 8
0
 public static DA.Slave ToEntity(this DT.Slave source) {
   if (source == null) return null;
   var result = new DA.Slave();
   source.CopyToEntity(result);
   return result;
 }
Exemplo n.º 9
0
 public static void ToEntity(DT.Slave source, Slave target) {
   if ((source != null) && (target != null)) {
     target.ResourceId = source.Id;
     target.ParentResourceId = source.ParentResourceId;
     target.Cores = source.Cores;
     target.CpuSpeed = source.CpuSpeed;
     target.FreeCores = source.FreeCores;
     target.FreeMemory = source.FreeMemory;
     target.IsAllowedToCalculate = source.IsAllowedToCalculate;
     target.Memory = source.Memory;
     target.Name = source.Name;
     target.SlaveState = source.SlaveState;
     target.CpuArchitecture = source.CpuArchitecture;
     target.OperatingSystem = source.OperatingSystem;
     target.LastHeartbeat = source.LastHeartbeat;
     target.CpuUtilization = source.CpuUtilization;
   }
 }
Exemplo n.º 10
0
 public static DT.Slave ToDto(Slave source) {
   if (source == null) return null;
   return new DT.Slave {
     Id = source.ResourceId,
     ParentResourceId = source.ParentResourceId,
     Cores = source.Cores,
     CpuSpeed = source.CpuSpeed,
     FreeCores = source.FreeCores,
     FreeMemory = source.FreeMemory,
     IsAllowedToCalculate = source.IsAllowedToCalculate,
     Memory = source.Memory,
     Name = source.Name,
     SlaveState = source.SlaveState,
     CpuArchitecture = source.CpuArchitecture,
     OperatingSystem = source.OperatingSystem,
     LastHeartbeat = source.LastHeartbeat,
     CpuUtilization = source.CpuUtilization
   };
 }