Esempio n. 1
0
        private static void TestConfigurationParser()
        {
            Console.WriteLine("DataStreamGenerator Configuration Parser .NET");
            Console.WriteLine("=============================================\n");

            string tomlFile = @"C:\Users\P41608\Desktop\DSG_conf1.toml";

            ConfigurationParser.GetSeriesConfigurations(tomlFile);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("DataStreamGenerator v1.0");
            Console.WriteLine("------------------------\n");

            // parse configuration toml file
            string tomlFile = @"\configs\DSG_conf2.toml";

            Console.WriteLine($"parsing configuration file: {tomlFile}");
            var generatorConfig = ConfigurationParser.GetGeneratorConfig(tomlFile);
            var configDict      = ConfigurationParser.GetSeriesConfigurations(tomlFile);
            var seriesDict      = new Dictionary <string, DoubleSeries>();

            // convert to taskable jobs
            Console.WriteLine("convert configuration to jobs");
            foreach (var sc in configDict)
            {
                if (sc.Value.GetType() == typeof(ARSeriesConfig) || sc.Value.GetType() == typeof(ARMASeriesConfig) || sc.Value.GetType() == typeof(PFSeriesConfig))
                {
                    seriesDict.Add(sc.Key, new DoubleSeries());
                }
            }

            // setup environment
            Random rnd;

            if (generatorConfig.Seed >= 0)
            {
                rnd = new Random(generatorConfig.Seed);
            }
            else
            {
                rnd = new Random();
            }
            Random groupNameRnd   = new Random(); // if ENV=development
            var    group          = generatorConfig.Id + "_" + groupNameRnd.Next(1, 10000);
            var    brokerHostName = generatorConfig.BrokerHostName;

            // Stream or Generate
            switch (generatorConfig.Type.Trim().ToLower())
            {
            case "stream":
                Stream(generatorConfig, group, seriesDict, configDict, rnd);
                break;

            case "generate":
                Generate(generatorConfig, seriesDict, rnd);
                break;
            }
        }