コード例 #1
0
            /** <inheritDoc /> */
            override public IDictionary <IComputeJob <T>, IClusterNode> Map(IList <IClusterNode> subgrid, Tuple <bool, T> arg)
            {
                _gridName = null;

                Assert.AreEqual(2, subgrid.Count);

                bool local = arg.Item1;
                T    res   = arg.Item2;

                var jobs = new Dictionary <IComputeJob <T>, IClusterNode>();

                IComputeJob <T> job;

                if (res is BinarizableResult)
                {
                    TestBinarizableJob job0 = new TestBinarizableJob();

                    job0.SetArguments(res);

                    job = (IComputeJob <T>)job0;
                }
                else
                {
                    TestJob <T> job0 = new TestJob <T>();

                    job0.SetArguments(res);

                    job = job0;
                }

                foreach (IClusterNode node in subgrid)
                {
                    bool add = local ? node.IsLocal : !node.IsLocal;

                    if (add)
                    {
                        jobs.Add(job, node);

                        break;
                    }
                }

                Assert.AreEqual(1, jobs.Count);

                return(jobs);
            }
コード例 #2
0
ファイル: FailoverTaskSelfTest.cs プロジェクト: syzer/ignite
            /** <inheritDoc /> */
            override public IDictionary <IComputeJob <int>, IClusterNode> Map(IList <IClusterNode> subgrid, Tuple <bool, bool> arg)
            {
                Assert.AreEqual(2, subgrid.Count);

                Tuple <bool, bool> t = arg;

                bool serializable = t.Item1;
                bool local        = t.Item2;

                IDictionary <IComputeJob <int>, IClusterNode> jobs = new Dictionary <IComputeJob <int>, IClusterNode>();

                IComputeJob <int> job;

                if (serializable)
                {
                    job = new TestSerializableJob();
                }
                else
                {
                    job = new TestBinarizableJob();
                }

                foreach (IClusterNode node in subgrid)
                {
                    bool add = local ? node.IsLocal : !node.IsLocal;

                    if (add)
                    {
                        jobs.Add(job, node);

                        break;
                    }
                }

                Assert.AreEqual(1, jobs.Count);

                return(jobs);
            }