Example #1
0
        //private SolutionState State;

        //private Task WriteStateAsync()
        //{
        //	return TaskDone.Done;
        //}

        //private Task ClearStateAsync()
        //{
        //	return TaskDone.Done;
        //}

        public override async Task OnActivateAsync()
        {
            //this.State = new SolutionState();

            await StatsHelper.RegisterActivation("SolutionGrain", this.GrainFactory);

            Logger.OrleansLogger = this.GetLogger();
            Logger.LogInfo(this.GetLogger(), "SolutionGrain", "OnActivate", "Enter");

            this.projectsReadyCount = 0;

            //Task.Run(async () =>
            //await Task.Factory.StartNew(async () =>
            //{
            try
            {
                if (!string.IsNullOrEmpty(this.State.SolutionPath))
                {
                    this.solutionManager = await OrleansSolutionManager.CreateFromSolutionAsync(this, this.GrainFactory, this.State.SolutionPath);
                }
                else if (!string.IsNullOrEmpty(this.State.Source))
                {
                    this.solutionManager = await OrleansSolutionManager.CreateFromSourceAsync(this, this.GrainFactory, this.State.Source);
                }
                else if (!string.IsNullOrEmpty(this.State.TestName))
                {
                    this.solutionManager = await OrleansSolutionManager.CreateFromTestAsync(this, this.GrainFactory, this.State.TestName);
                }

                //if (this.solutionManager != null)
                //{
                //	await this.WaitForAllProjects();
                //}
            }
            catch (Exception ex)
            {
                var inner = ex;
                while (inner is AggregateException)
                {
                    inner = inner.InnerException;
                }

                Logger.LogError(this.GetLogger(), "SolutionGrain", "OnActivate", "Error:\n{0}\nInner:\n{1}", ex, inner);
                throw ex;
            }
            //});

            Logger.LogInfo(this.GetLogger(), "SolutionGrain", "OnActivate", "Exit");
        }
Example #2
0
        public async Task SetSolutionFromTestAsync(string testName)
        {
            await StatsHelper.RegisterMsg("SolutionGrain::SetSolutionFromTest", this.GrainFactory);

            Logger.LogVerbose(this.GetLogger(), "SolutionGrain", "SetSolutionFromTest", "Enter");

            this.State.TestName     = testName;
            this.State.SolutionPath = null;
            this.State.Source       = null;

            await this.WriteStateAsync();

            this.projectsReadyCount = 0;

            //Task.Run(async () =>
            //await Task.Factory.StartNew(async () =>
            //{
            try
            {
                this.solutionManager = await OrleansSolutionManager.CreateFromTestAsync(this, this.GrainFactory, this.State.TestName);

                //await this.WaitForAllProjects();
            }
            catch (Exception ex)
            {
                var inner = ex;
                while (inner is AggregateException)
                {
                    inner = inner.InnerException;
                }

                Logger.LogError(this.GetLogger(), "SolutionGrain", "SetSolutionFromTest", "Error:\n{0}\nInner:\n{1}", ex, inner);
                throw ex;
            }
            //});

            Logger.LogVerbose(this.GetLogger(), "SolutionGrain", "SetSolutionFromTest", "Exit");
        }