Beispiel #1
0
        public async Task <ActionResult> SetVelocity(double velocity)
        {
            IControllerGrain controller = ControllerGrainFactory.GetGrain(0);
            await controller.SetVelocity(velocity);

            return(RedirectToAction("index"));
        }
Beispiel #2
0
        public async Task <ActionResult> Stop()
        {
            IControllerGrain controller = ControllerGrainFactory.GetGrain(0);
            await controller.StopSimulation();

            MvcApplication.GlobalObserver.c_sent = 0;

            return(RedirectToAction("index", "home"));
        }
Beispiel #3
0
 public async Task Init(IGrainFactory factory)
 {
     workflowControllerGrain = factory.GetGrain <IControllerGrain>(WorkflowID);
     foreach (Operator o in AllOperators)
     {
         o.SetPrincipalGrain(factory);
     }
     await workflowControllerGrain.Init(workflowControllerGrain, WorkflowID, AllOperators);
 }
Beispiel #4
0
        public async Task <ActionResult> Start()
        {
            int    batch_count = int.Parse(Request.Params["batchcount"]);
            int    batch_size  = int.Parse(Request.Params["batchsize"]);
            int    delay       = int.Parse(Request.Params["delay"]);
            int    runtime     = int.Parse(Request.Params["runtime"]);
            string url         = Request.Params["testurl"];

            // Controller
            IControllerGrain controller = ControllerGrainFactory.GetGrain(0);
            await controller.StartSimulation(batch_count, batch_size, delay, runtime, url);

            return(RedirectToAction("index"));
        }
 public async Task Init(IControllerGrain self, Guid workflowID, HashSet <Operator> graph)
 {
     this.self  = self;
     WorkflowID = workflowID;
     foreach (Operator o in graph)
     {
         await o.PrincipalGrain.Init(self, workflowID, o);
     }
     foreach (Operator o in graph)
     {
         await o.LinkPrincipleGrain();
     }
     foreach (Operator o in graph)
     {
         await o.LinkWorkerGrains();
     }
 }
        public async Task Init(IControllerGrain controllerGrain, Guid workflowID, Operator currentOperator)
        {
            this.controllerGrain = controllerGrain;
            this.workflowID      = workflowID;
            this.operatorID      = currentOperator.OperatorGuid;
            this.self            = currentOperator.PrincipalGrain;
            this.predicate       = currentOperator.Predicate;
            await BuildWorkerTopology();

            PassExtraParametersByPredicate(ref this.predicate);
            foreach (List <IWorkerGrain> grainList in operatorGrains)
            {
                foreach (IWorkerGrain grain in grainList)
                {
                    await grain.Init(grain, predicate, self);
                }
            }
        }
Beispiel #7
0
        public async Task <SiloAddress> Init(IControllerGrain self, string plan, bool checkpointActivated = false)
        {
            this.self = self;
            ApplyLogicalPlan(CompileLogicalPlan(plan, checkpointActivated));
            await InitOperators(checkpointActivated);

            var sinks = nodes.Keys.Where(x => nodeMetadata[x].GetType() != typeof(HashBasedMaterializerOperator) && nodeMetadata[x].GetType() != typeof(LocalMaterializerOperator) && !forwardLinks.ContainsKey(x)).ToList();

            await LinkToObserver(sinks);

            Console.WriteLine("# of sinks: " + numberOfOutputGrains);
            foreach (var pair in startDependencies)
            {
                Console.WriteLine("ID: " + pair.Key);
                foreach (var id in pair.Value)
                {
                    Console.WriteLine("\tdepends on: " + id);
                }
            }
            return(localSiloDetails.SiloAddress);
        }
Beispiel #8
0
        public virtual async Task Init(IControllerGrain controllerGrain, Operator op, List <Pair <Operator, WorkerLayer> > prev)
        {
            this.controllerGrain = controllerGrain;
            this.self            = this.GrainReference.Cast <IPrincipalGrain>();
            this.operatorCore    = op;
            var topology = this.operatorCore.GenerateTopology();

            grainLayers = topology.First;
            links       = topology.Second;
            foreach (var layer in grainLayers)
            {
                await layer.Build(self, GrainFactory, prev);

                foreach (IWorkerGrain worker in layer.Layer.Values.SelectMany(x => x))
                {
                    workerStates[worker] = WorkerState.UnInitialized;
                }
            }
            foreach (var link in links)
            {
                await link.Link();
            }
        }