Exemplo n.º 1
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (task.Package.ToLower() == "semp" || task.Package.ToLower() == "orca")
            {
                var node = resource.Nodes.First();

                if (node.CoresAvailable > 0 && resource.ResourceName.ToLower() == "cluster_niinkt_1" && node.HasPackage(task.Package))
                {
                    return new Estimation(
                        task.TaskId,
                        resource.ProviderName,
                        resource.ResourceName,
                        new int[1] {
                        task.Package.ToLower() == "semp"? 1 : 4
                    }
                        )
                           {
                               ExecutionTime = TimeSpan.FromMilliseconds(5)
                           }
                }
                ;
            }

            return(null);
        }
    }
Exemplo n.º 2
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (resource.ProviderName == CONST.Providers.WinPc)
            {
                var node = resource.Nodes.First();

                if (node.HasPackage(task.Package) && node.CoresAvailable > 0)
                {
                    string nodeName = node.NodeName;

                    return(new Estimation(
                               task.TaskId,
                               resource.ProviderName,
                               resource.ResourceName,
                               resource.Nodes.Select(n => (n.NodeName == nodeName)? 1 : 0).ToArray()
                               )
                    {
                        //ExecutionTime = new TimeSpan(Math.Max(0, 500 - nodes.Length)*SEC_IN_TICKS),
                        ExecutionTime = TimeSpan.FromSeconds(2),
                    });
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        public Task(TaskDescription description)
            : base(description)
        {
            if (Priority == TaskPriority.Urgent)
            {
                if (!ExecParams.ContainsKey("MinTime"))
                    ExecParams["MinTime"] = "0";

                if (!ExecParams.ContainsKey("MaxTime"))
                    ExecParams["MaxTime"] = ExecParams["MinTime"];
            }

            OutputParams = new Dictionary<string, string>();

            Time = new TaskTimeMeasurement();
            Time.Started(TaskTimeMetric.Postponed);
            if (this.IsFake())
                Time.Edge(started: TaskTimeMetric.Queued, finished: TaskTimeMetric.Postponed);

            Estimations = null;
            CurrentSchedule = null;
            Incarnation = new IncarnationParams();

            State = TaskState.Defined;

            string stepName = ExecParams.ContainsKey("StepName")? ExecParams["StepName"]: null;
            string storageRoot = IOProxy.Storage.BuildPath(UserId, WfId, stepId: TaskId.ToString(), stepName: stepName);
            this.PackageEngineState = new PackageEngineState(description, storageRoot); // todo : measure PackageEngineState expenses
        }
Exemplo n.º 4
0
        public virtual Estimation EstimateIfMatches(TaskDescription task, Resource resource)
		{
            // todo : EstimateIfMatches => try/catch & nodes != null & nodes.Any() & nodes.First().HavePackage(task.Package)

			if (Matches(task, resource))
                return Estimate(task, resource);

			return null;
		}
Exemplo n.º 5
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            /*
             * if (nodes.First().ClusterName.ToLower() == REQUIRED_CLUSTER_NAME.ToLower())
             *  return true;
             * /**/

            return(false);
        }
Exemplo n.º 6
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            /*
            if (nodes.First().ClusterName.ToLower() == "cluster_niinkt_1")
                return true;
            /**/

			return false;
		}
Exemplo n.º 7
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            /*
             * if (nodes.First().ClusterName.ToLower() == "cluster_niinkt_1")
             *  return true;
             * /**/

            return(false);
        }
Exemplo n.º 8
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            return(false);

            if (resource.ProviderName == CONST.Providers.WinPc && resource.Nodes.First().HasPackage(task.Package))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 9
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
			// get all available nodes with all their cores
            int n = resource.Nodes.Sum(node => node.CoresAvailable);
            int[] cores = resource.Nodes.Select(node => node.CoresAvailable).ToArray();

			long sec = (long) 1e7;
			TimeSpan time = new TimeSpan((long) (240.0 * sec / (1.0 * n)));

            return new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, cores) { ExecutionTime = time };
		}
Exemplo n.º 10
0
        public virtual Estimation EstimateIfMatches(TaskDescription task, Resource resource)
        {
            // todo : EstimateIfMatches => try/catch & nodes != null & nodes.Any() & nodes.First().HavePackage(task.Package)

            if (Matches(task, resource))
            {
                return(Estimate(task, resource));
            }

            return(null);
        }
Exemplo n.º 11
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            return(false);

            /*
             * if (task.Package == Packs.Plasmon && task.Params["SGRAPH2DFILEEXT"] != null &&
             *      task.Params["SGRAPH2DFILEEXT"].ToLower() == "grd")
             *      return true;
             *
             * return false;
             */
        }
Exemplo n.º 12
0
 protected override Estimation Estimate(TaskDescription task, Resource resource)
 {
     return(new Estimation(
                task.TaskId,
                resource.ProviderName,
                resource.ResourceName,
                new int[1] {
         1
     }
                )
     {
         ExecutionTime = new TimeSpan(0),
     });
 }
Exemplo n.º 13
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
			// get 1 core on 1 node, less time estimated

            int n = 0;
            int[] cores = Enumerable.Range(0, resource.Nodes.Count).ToArray();

            cores[0] = 1;

			long sec = (long) 1e7;
			TimeSpan time = new TimeSpan((long) (0.5 * n * 240.0 * sec / (1.0)));

            return new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, cores) { ExecutionTime = time };
        }
Exemplo n.º 14
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            if (task.Package.ToLower() == "orca" && task.Method.ToUpper() == "MCSCF+MR-CI")
            {
                return(true);
            }

            if (task.Package.ToLower() == "orca" && task.Method.ToUpper() == "TDDFT")
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 15
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            // get all available nodes with all their cores
            int n = resource.Nodes.Sum(node => node.CoresAvailable);

            int[] cores = resource.Nodes.Select(node => node.CoresAvailable).ToArray();

            long     sec  = (long)1e7;
            TimeSpan time = new TimeSpan((long)(240.0 * sec / (1.0 * n)));

            return(new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, cores)
            {
                ExecutionTime = time
            });
        }
Exemplo n.º 16
0
        public void Init(TaskDescription taskDescription, string storagePathBase)
        {
            StoragePathBase = storagePathBase;

            if (_taskDescription == null)
                _taskDescription = new TaskDescription(taskDescription);

            if (CompiledDef == null)
                CompiledDef = PackageBaseProxy.GetCompiledDef(taskDescription.Package);

            if (EngineContext == null)
            {
                var engine = new PackageEngine(CompiledDef);
                EngineContext = engine.Ctx;
            }
        }
Exemplo n.º 17
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            // get 1 core on 1 node, less time estimated

            int n = 0;

            int[] cores = Enumerable.Range(0, resource.Nodes.Count).ToArray();

            cores[0] = 1;

            long     sec  = (long)1e7;
            TimeSpan time = new TimeSpan((long)(0.5 * n * 240.0 * sec / (1.0)));

            return(new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, cores)
            {
                ExecutionTime = time
            });
        }
Exemplo n.º 18
0
        public void Init(TaskDescription taskDescription, string storagePathBase)
        {
            StoragePathBase = storagePathBase;

            if (_taskDescription == null)
            {
                _taskDescription = new TaskDescription(taskDescription);
            }

            if (CompiledDef == null)
            {
                CompiledDef = PackageBaseProxy.GetCompiledDef(taskDescription.Package);
            }

            if (EngineContext == null)
            {
                var engine = new PackageEngine(CompiledDef);
                EngineContext = engine.Ctx;
            }
        }
Exemplo n.º 19
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (resource.Nodes.First().OtherSoftware.Contains("windows") && resource.Nodes.First().HasPackage("ORCA"))
            {
                return new Estimation(
                    task.TaskId,
                    resource.ProviderName,
                    resource.ResourceName,
                    new int[1] {
                    1
                }
                    )
                       {
                           //ExecutionTime = new TimeSpan(Math.Max(0, 500 - nodes.Length)*SEC_IN_TICKS),
                           ExecutionTime = new TimeSpan(0 * SEC_IN_TICKS),
                       }
            }
            ;

            return(null);
        }
    }
Exemplo n.º 20
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            var node = resource.Nodes.First();

            if (resource.ResourceName.ToLower() == "cluster_niinkt_1" && node.HasPackage(task.Package))
            {
                return new Estimation(
                    task.TaskId,
                    resource.ProviderName,
                    resource.ResourceName,
                    new int[1] {
                    1
                }
                    )
                       {
                           ExecutionTime = new TimeSpan(0)
                       }
            }
            ;

            return(null);
        }
    }
Exemplo n.º 21
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (resource.ProviderName == CONST.Providers.GridNns && resource.Nodes.First().HasPackage(task.Package) &&
                resource.Nodes.Sum(n => n.CoresAvailable) > 0)
            {
                return new Estimation(
                    task.TaskId,
                    resource.ProviderName,
                    resource.ResourceName,
                    Enumerable.Range(0, resource.Nodes.Count).Zip(resource.Nodes,
                                                                  (zero, n) => (n.CoresAvailable > 0)? 1 : 0
                                                                  ).ToArray()
                    )
                       {
                           //ExecutionTime = new TimeSpan(Math.Max(0, 500 - nodes.Length)*SEC_IN_TICKS),
                           ExecutionTime = new TimeSpan(0 * SEC_IN_TICKS),
                       }
            }
            ;

            return(null);
        }
    }
Exemplo n.º 22
0
        public Task(TaskDescription description)
            : base(description)
        {
            if (Priority == TaskPriority.Urgent)
            {
                if (!ExecParams.ContainsKey("MinTime"))
                {
                    ExecParams["MinTime"] = "0";
                }

                if (!ExecParams.ContainsKey("MaxTime"))
                {
                    ExecParams["MaxTime"] = ExecParams["MinTime"];
                }
            }

            OutputParams = new Dictionary <string, string>();

            Time = new TaskTimeMeasurement();
            Time.Started(TaskTimeMetric.Postponed);
            if (this.IsFake())
            {
                Time.Edge(started: TaskTimeMetric.Queued, finished: TaskTimeMetric.Postponed);
            }

            Estimations     = null;
            CurrentSchedule = null;
            Incarnation     = new IncarnationParams();

            State = TaskState.Defined;

            string stepName    = ExecParams.ContainsKey("StepName")? ExecParams["StepName"]: null;
            string storageRoot = IOProxy.Storage.BuildPath(UserId, WfId, stepId: TaskId.ToString(), stepName: stepName);

            this.PackageEngineState = new PackageEngineState(description, storageRoot); // todo : measure PackageEngineState expenses
        }
Exemplo n.º 23
0
        protected override bool Matches(TaskDescription task, Resource resource)
		{
			return false;
		}
Exemplo n.º 24
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
			if (task == null || resource == null || !resource.Nodes.Any())
				return null;

			var limits = new[]
			{
				new { pack = "",             otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "GAMESS",       otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "ORCA",         otherSoft = "windows", maxCores = 1,  maxNodes = 1},
				new { pack = "ORCA",         otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "SEMP",         otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "Plasmon",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "QDLaser",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "JAggregate",   otherSoft = "",        maxCores = 1,  maxNodes = 1},
                //new { pack = "Plasmon",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
                //new { pack = "QDLaser",      otherSoft = "",        maxCores = 8,  maxNodes = 1},
                //new { pack = "JAggregate",   otherSoft = "",        maxCores = 8,  maxNodes = 1},
				//new { pack = "NanoFlow",     otherSoft = "",        maxCores = 16*3, maxNodes = 3},
				new { pack = "NanoFlow",     otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "MD_KMC",       otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "MD_KMC",       otherSoft = "windows", maxCores = 0,  maxNodes = 0},
				new { pack = "NTDMFT",       otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "Dalton",       otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "NAEN",         otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "Upconversion", otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "TestP",        otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "Belman",       otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "SWAN",         otherSoft = "",        maxCores = 1,  maxNodes = 1},
			};

            var packLimits = limits.Where(l => String.IsNullOrWhiteSpace(l.pack));
            if (limits.Any(limit => limit.pack.ToLower() == task.Package.ToLower()))
                packLimits = limits.Where(limit => limit.pack.ToLower() == task.Package.ToLower());

			// selecting proper limit (maximize software matches):
            
            var properPackLimit = packLimits.First();
			int maxSoftMatches = 0;
            
            foreach (var packLimit in packLimits)
			{
				int softMathcesCount = 0;
				string[] otherSoft = packLimit.otherSoft.Split(new char[] { ' ', '\t', '\r', '\n', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

				foreach (string soft in otherSoft)
				{
					// todo : [future] packs on different nodes can be different
					if (resource.Nodes.First().OtherSoftware.Contains(soft.ToLower()))
						softMathcesCount++;
				}

				if (softMathcesCount > maxSoftMatches || (packLimit.maxCores > properPackLimit.maxCores && softMathcesCount == maxSoftMatches))
				{
					maxSoftMatches = softMathcesCount;
					properPackLimit = packLimit;
				}
			}

            // Choose number of cores for each node:

            var coresOnNode = new List<int>();
			int coresToDo = properPackLimit.maxCores;
			int nodesToDo = properPackLimit.maxNodes;

			foreach (var node in resource.Nodes)
			{
                if (coresToDo > 0 && nodesToDo > 0)
                {
                    int coresOnCurrentNode = Math.Min(node.CoresAvailable, coresToDo);

                    coresOnNode.Add(coresOnCurrentNode);
                    coresToDo -= coresOnCurrentNode;
                    nodesToDo -= (coresOnCurrentNode == 0) ? 0 : 1;
                }
                else
                    coresOnNode.Add(0);
			}

			int coresFound = coresOnNode.Sum();
			if (coresFound == 0) // haven't found anything
				return null;

            // Estimate (clusters with more nodes are preferable, so subtract it's nodes.Count from time estimation):

			TimeSpan time = new TimeSpan((long) ((Math.Round(18000.0 / coresFound) - resource.Nodes.Count + 60)*SEC_IN_TICKS));
            Estimation estimation = new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, coresOnNode.ToArray()) 
                { ExecutionTime = time };

			return estimation;
		}
Exemplo n.º 25
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (resource.ProviderName == CONST.Providers.WinPc)
            {
                var node = resource.Nodes.First();

                if (node.HasPackage(task.Package) && node.CoresAvailable > 0)
                {
                    string nodeName = node.NodeName;

                    return new Estimation(
                        task.TaskId,
                        resource.ProviderName,
                        resource.ResourceName,
                        resource.Nodes.Select(n => (n.NodeName == nodeName)? 1 : 0).ToArray()
                    )
                    {
                        //ExecutionTime = new TimeSpan(Math.Max(0, 500 - nodes.Length)*SEC_IN_TICKS),
                        ExecutionTime = TimeSpan.FromSeconds(2),
                    };
                }
            }

            return null;
        }
Exemplo n.º 26
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            return false;

            if (resource.ProviderName == CONST.Providers.WinPc && resource.Nodes.First().HasPackage(task.Package))
                return true;

            return false;
        }
Exemplo n.º 27
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (task == null || resource == null || !resource.Nodes.Any())
            {
                return(null);
            }

            var limits = new[]
            {
                new { pack = "", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "GAMESS", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "ORCA", otherSoft = "windows", maxCores = 1, maxNodes = 1 },
                new { pack = "ORCA", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "SEMP", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "Plasmon", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "QDLaser", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "JAggregate", otherSoft = "", maxCores = 1, maxNodes = 1 },
                //new { pack = "Plasmon",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
                //new { pack = "QDLaser",      otherSoft = "",        maxCores = 8,  maxNodes = 1},
                //new { pack = "JAggregate",   otherSoft = "",        maxCores = 8,  maxNodes = 1},
                //new { pack = "NanoFlow",     otherSoft = "",        maxCores = 16*3, maxNodes = 3},
                new { pack = "NanoFlow", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "MD_KMC", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "MD_KMC", otherSoft = "windows", maxCores = 0, maxNodes = 0 },
                new { pack = "NTDMFT", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "Dalton", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "NAEN", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "Upconversion", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "TestP", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "Belman", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "SWAN", otherSoft = "", maxCores = 1, maxNodes = 1 },
            };

            var packLimits = limits.Where(l => String.IsNullOrWhiteSpace(l.pack));

            if (limits.Any(limit => limit.pack.ToLower() == task.Package.ToLower()))
            {
                packLimits = limits.Where(limit => limit.pack.ToLower() == task.Package.ToLower());
            }

            // selecting proper limit (maximize software matches):

            var properPackLimit = packLimits.First();
            int maxSoftMatches  = 0;

            foreach (var packLimit in packLimits)
            {
                int      softMathcesCount = 0;
                string[] otherSoft        = packLimit.otherSoft.Split(new char[] { ' ', '\t', '\r', '\n', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string soft in otherSoft)
                {
                    // todo : [future] packs on different nodes can be different
                    if (resource.Nodes.First().OtherSoftware.Contains(soft.ToLower()))
                    {
                        softMathcesCount++;
                    }
                }

                if (softMathcesCount > maxSoftMatches || (packLimit.maxCores > properPackLimit.maxCores && softMathcesCount == maxSoftMatches))
                {
                    maxSoftMatches  = softMathcesCount;
                    properPackLimit = packLimit;
                }
            }

            // Choose number of cores for each node:

            var coresOnNode = new List <int>();
            int coresToDo   = properPackLimit.maxCores;
            int nodesToDo   = properPackLimit.maxNodes;

            foreach (var node in resource.Nodes)
            {
                if (coresToDo > 0 && nodesToDo > 0)
                {
                    int coresOnCurrentNode = Math.Min(node.CoresAvailable, coresToDo);

                    coresOnNode.Add(coresOnCurrentNode);
                    coresToDo -= coresOnCurrentNode;
                    nodesToDo -= (coresOnCurrentNode == 0) ? 0 : 1;
                }
                else
                {
                    coresOnNode.Add(0);
                }
            }

            int coresFound = coresOnNode.Sum();

            if (coresFound == 0)             // haven't found anything
            {
                return(null);
            }

            // Estimate (clusters with more nodes are preferable, so subtract it's nodes.Count from time estimation):

            TimeSpan   time       = new TimeSpan((long)((Math.Round(18000.0 / coresFound) - resource.Nodes.Count + 60) * SEC_IN_TICKS));
            Estimation estimation = new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, coresOnNode.ToArray())
            {
                ExecutionTime = time
            };

            return(estimation);
        }
Exemplo n.º 28
0
 public PackageEngineState(TaskDescription taskDescription, string storagePathBase)
 {
     Init(taskDescription, storagePathBase);
 }
Exemplo n.º 29
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
            /*
            if (nodes.First().ClusterName.ToLower() == REQUIRED_CLUSTER_NAME.ToLower())
                return true;
            /**/

            return false;
		}
Exemplo n.º 30
0
 protected abstract Estimation Estimate(TaskDescription task, Resource resource);
Exemplo n.º 31
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            var node = resource.Nodes.First();

            if (resource.ResourceName.ToLower() == "cluster_niinkt_1" && node.HasPackage(task.Package))
                return new Estimation(
                    task.TaskId, 
                    resource.ProviderName,
                    resource.ResourceName,
                    new int[1] { 1 }
                )
                {
                    ExecutionTime = new TimeSpan(0)
                };

			return null;
		}
Exemplo n.º 32
0
 protected abstract Estimation Estimate(TaskDescription task, Resource resource);
Exemplo n.º 33
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
			return false;

			/*
			if (task.Package == Packs.Plasmon && task.Params["SGRAPH2DFILEEXT"] != null &&
				task.Params["SGRAPH2DFILEEXT"].ToLower() == "grd")
				return true;

			return false;
			*/
		}
Exemplo n.º 34
0
 public PackageEngineState(TaskDescription taskDescription, string storagePathBase)
 {
     Init(taskDescription, storagePathBase);
 }
Exemplo n.º 35
0
        public TaskDescription(TaskDescription other)
        {
            WfId     = String.IsNullOrEmpty(other.WfId)? "0" : other.WfId;
            TaskId   = other.TaskId;
            UserId   = other.UserId; // todo : userId == null?
            UserCert = other.UserCert;

            Priority   = other.Priority;
            LaunchMode = other.LaunchMode;

            Package = other.Package;
            Method  = other.Method ?? "";

            if (other.Params != null)
            {
                Params = new Dictionary <string, string>(other.Params);
            }
            else
            {
                Params = new Dictionary <string, string>();
            }

            if (other.ExecParams != null)
            {
                ExecParams = new Dictionary <string, string>(other.ExecParams);
            }
            else
            {
                ExecParams = new Dictionary <string, string>();
            }

            if (other.InputFiles != null) // todo: inputs.ToArray()?
            {
                var inputsList = other.InputFiles.ToList();
                int len        = inputsList.Count();
                InputFiles = new TaskFileDescription[len];

                for (int i = 0; i < len; i++)
                {
                    InputFiles[i] = new TaskFileDescription
                    {
                        FileName  = inputsList[i].FileName,
                        SlotName  = inputsList[i].SlotName,
                        StorageId = inputsList[i].StorageId,
                    };
                }
            }
            else
            {
                InputFiles = new TaskFileDescription[0]; // todo : is it ok?
            }
            if (other.OutputFiles != null)
            {
                var outputsList = other.OutputFiles.ToList();
                int len         = outputsList.Count();
                OutputFiles = new TaskFileDescription[len];

                for (int i = 0; i < len; i++)
                {
                    OutputFiles[i] = new TaskFileDescription
                    {
                        FileName  = outputsList[i].FileName,
                        SlotName  = outputsList[i].SlotName,
                        StorageId = outputsList[i].StorageId,
                    };
                }
            }
            else
            {
                OutputFiles = new TaskFileDescription[0]; // todo : is it ok?
            }
        }
Exemplo n.º 36
0
 protected abstract bool Matches(TaskDescription task, Resource resource);
Exemplo n.º 37
0
        protected override bool Matches(TaskDescription task, Resource resource)
        {
			if (task.Package.ToLower() == "orca" && task.Method.ToUpper() == "MCSCF+MR-CI")
				return true;

            if (task.Package.ToLower() == "orca" && task.Method.ToUpper() == "TDDFT")
				return true;

			return false;
		}
Exemplo n.º 38
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
			return new Estimation(
                task.TaskId, 
                resource.ProviderName,
                resource.ResourceName,
				new int[1] { 1 }
            ) {
                ExecutionTime = new TimeSpan(0),
            };
		}
Exemplo n.º 39
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (resource.Nodes.First().OtherSoftware.Contains("windows") && resource.Nodes.First().HasPackage("ORCA"))
                return new Estimation(
                    task.TaskId, 
                    resource.ProviderName,
                    resource.ResourceName,
                    new int[1] { 1 }
                ) {
                    //ExecutionTime = new TimeSpan(Math.Max(0, 500 - nodes.Length)*SEC_IN_TICKS),
                    ExecutionTime = new TimeSpan(0*SEC_IN_TICKS),
                };

			return null;
		}
Exemplo n.º 40
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (resource.ProviderName == CONST.Providers.GridNns && resource.Nodes.First().HasPackage(task.Package) &&
                resource.Nodes.Sum(n => n.CoresAvailable) > 0)
                return new Estimation(
                    task.TaskId,
                    resource.ProviderName,
                    resource.ResourceName,
                    Enumerable.Range(0, resource.Nodes.Count).Zip(resource.Nodes,
                        (zero, n) => (n.CoresAvailable > 0)? 1 : 0
                    ).ToArray()
                )
                {
                    //ExecutionTime = new TimeSpan(Math.Max(0, 500 - nodes.Length)*SEC_IN_TICKS),
                    ExecutionTime = new TimeSpan(0*SEC_IN_TICKS),
                };

            return null;
        }
Exemplo n.º 41
0
 protected override bool Matches(TaskDescription task, Resource resource)
 {
     return(false);
 }
Exemplo n.º 42
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
			if (task.Package.ToLower() == "semp" || task.Package.ToLower() == "orca")
			{
                var node = resource.Nodes.First();

                if (node.CoresAvailable > 0 && resource.ResourceName.ToLower() == "cluster_niinkt_1" && node.HasPackage(task.Package))
                    return new Estimation(
                        task.TaskId, 
                        resource.ProviderName,
                        resource.ResourceName,
                        new int[1] { 
							task.Package.ToLower() == "semp"? 1 : 4
						}
                    ) {
                        ExecutionTime = TimeSpan.FromMilliseconds(5)
                    };
			}

			return null;
		}
Exemplo n.º 43
0
 protected abstract bool Matches(TaskDescription task, Resource resource);
Exemplo n.º 44
0
        public void DefineTask(TaskDescription taskDesription)
        {
            try
            {
                string descrJson = taskDesription.ToJsonString();
                Log.Info(String.Format("Trying to define task {0}: {1}", taskDesription.TaskId, descrJson));

                var supportedPackages = PackageBaseProxy.GetSupportedPackageNames();
                if (!supportedPackages.Any(p => String.Equals(p, taskDesription.Package, StringComparison.InvariantCultureIgnoreCase)))
                    throw new Exception(String.Format("Package {0} is not supported in Package Base", taskDesription.Package));

                //                lock (_updateLock)
                {
                    lock (_queueLock)
                    {
                        var task = new Task(taskDesription);

                        _definesQueue.Add(task);
                        Log.Info(String.Format("Task {0} ({1}) def-queued", task.TaskId, task.Package));
                        /*
                        _tasksQueue.RemoveAll(t => t.TaskId == task.TaskId);
                        _tasksQueue.Add(task);
                        Log.Info(String.Format("Task {0} ({1}) queued", task.TaskId, task.Package));
                        */
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(String.Format("Error defining task {2}: {0}\n{1}", e.Message, e.StackTrace, taskDesription.TaskId));
                throw;
            }
        }
Exemplo n.º 45
0
        public TaskDescription(TaskDescription other)
        {
            WfId = String.IsNullOrEmpty(other.WfId)? "0" : other.WfId;
            TaskId = other.TaskId;
            UserId = other.UserId; // todo : userId == null?
            UserCert = other.UserCert;

            Priority = other.Priority;
            LaunchMode = other.LaunchMode;

            Package = other.Package;
            Method = other.Method ?? "";

            if (other.Params != null)
                Params = new Dictionary<string, string>(other.Params);
            else
                Params = new Dictionary<string, string>();

            if (other.ExecParams != null)
                ExecParams = new Dictionary<string, string>(other.ExecParams);
            else
                ExecParams = new Dictionary<string, string>();

            if (other.InputFiles != null) // todo: inputs.ToArray()?
            {
                var inputsList = other.InputFiles.ToList();
                int len = inputsList.Count();
                InputFiles = new TaskFileDescription[len];

                for (int i=0; i<len; i++)
                {
                    InputFiles[i] = new TaskFileDescription
                    {
                        FileName  = inputsList[i].FileName,
                        SlotName  = inputsList[i].SlotName,
                        StorageId = inputsList[i].StorageId,
                    };
                }
            }
            else
                InputFiles = new TaskFileDescription[0]; // todo : is it ok?

            if (other.OutputFiles != null)
            {
                var outputsList = other.OutputFiles.ToList();
                int len = outputsList.Count();
                OutputFiles = new TaskFileDescription[len];

                for (int i=0; i<len; i++)
                {
                    OutputFiles[i] = new TaskFileDescription
                    {
                        FileName  = outputsList[i].FileName,
                        SlotName  = outputsList[i].SlotName,
                        StorageId = outputsList[i].StorageId,
                    };
                }
            }
            else
                OutputFiles = new TaskFileDescription[0]; // todo : is it ok?
        }