コード例 #1
0
        public void Build()
        {
            var dbChunk = new DbChunk(Settings.Current.Building.BuilderConnectionString);

            dbChunk.MarkUncompletedChunks(Settings.Current.Building.Id.Value, Settings.Current.Builder.Id.Value);

            PerformAction(() =>
            {
                Parallel.For(0, Settings.Current.Builder.MaxDegreeOfParallelism, i =>
                {
                    while (!chunkController.AllChunksStarted())
                    {
                        var arguments =
                            string.Format(@"<{0}>{1}</{0}>", "cs", Settings.Current.Building.BuilderConnectionString) +
                            string.Format(@"<{0}>{1}</{0}>", "s3keyid", Settings.Current.S3AwsAccessKeyId) +
                            string.Format(@"<{0}>{1}</{0}>", "s3accesskey", Settings.Current.S3AwsSecretAccessKey) +
                            string.Format(@"<{0}>{1}</{0}>", "ec2keyid", Settings.Current.Ec2AwsAccessKeyId) +
                            string.Format(@"<{0}>{1}</{0}>", "ec2accesskey", Settings.Current.Ec2AwsSecretAccessKey) +
                            string.Format(@"<{0}>{1}</{0}>", "SubChunkSize", Settings.Current.SubChunkSize) +
                            string.Format(@"<{0}>{1}</{0}>", "bucket", Settings.Current.Bucket);

                        var psi =
                            new ProcessStartInfo(Path.Combine(Settings.Current.Builder.Folder, "org.ohdsi.cdm.presentation.builderprocess.exe"))
                        {
                            Arguments      = arguments,
                            CreateNoWindow = true
                        };

                        Thread.Sleep(1000);

                        using (var p = Process.Start(psi))
                        {
                            p.WaitForExit();
                            p.Close();
                        }

                        RefreshState();
                        if (Builder.State != BuilderState.Running)
                        {
                            break;
                        }
                    }
                });
            });
        }