示例#1
0
        public InstanceProgressForm(String runName, String folderPath, long memoryMaxBytesAllowed,
                                    int minNumSamples,
                                    String missingValueIdentifier,
                                    QDFGGraphManager.Settings.ModelDataType dataModel,
                                    QDFGGraphManager.Settings.TimeDataType timeModel,
                                    String numberFormat,
                                    int numSamples,
                                    int timeStepMS
                                    )
        {
            InitializeComponent();

            // init variables
            this.runName                = runName;
            this.folderPath             = folderPath;
            this.MemoryMaxBytesAllowed  = memoryMaxBytesAllowed;
            this.minNumSamples          = minNumSamples;
            this.MissingValueIdentifier = missingValueIdentifier;
            this.dataModel              = dataModel;
            this.timeModel              = timeModel;
            this.numberFormat           = numberFormat;
            this.numSamples             = numSamples;
            this.timeStepMS             = timeStepMS;

            // init Analyzer
            this.init();

            // run Instance
            //this.run();
            //Task.Run(this.runTasksSync());
            //this.runTasksSync();
            this.runTasksBackgroundSequential();
        }
        private void init(string[] args)
        {
            /*
            if (args.Length != 10)
            {
                throw new ArgumentException("Some arguments were invalid.");
            }*/

            Console.WriteLine("Arguments: ");
            foreach (string arg in args)
            {
                Console.WriteLine(arg + ", ");
            }

            /* Parse Arguments */
            try
            {
                //1: Run Name
                //2: folderPath
                //3: maxMBytes
                //4: minSamples
                //5: numSamples
                //6: missingValue
                //7: dataModel
                //8: timeModel
                //9: numberFormat
                //10: timeStep

                this.runName = args[1];
                this.folderPath = args[2];
                this.MemoryMaxBytesAllowed = (Int64.Parse(args[3]) * 1024 * 1024);
                this.minNumSamples = Int32.Parse(args[4]);
                this.numSamples = Int32.Parse(args[5]);
                this.MissingValueIdentifier = args[6];

                if (args[7] == "SAMPLE_BASED")
                    dataModel = QDFGGraphManager.Settings.ModelDataType.SAMPLE_BASED;
                else if (args[7] == "AGGREGATED_STATISTICS")
                    dataModel = QDFGGraphManager.Settings.ModelDataType.AGGREGATED_STATISTICS;
                else
                    throw new ArgumentException("Invalid Data Model: " + args[7]);

                if (args[8] == "TIME_STEPS")
                    timeModel = QDFGGraphManager.Settings.TimeDataType.TIME_STEPS;
                else
                    throw new ArgumentException("Invalid Time Model: " + args[8]);

                this.numberFormat = args[9];
                this.timeStepMS = Int32.Parse(args[10]);
                this.outputDirectory = args[11];

                // Verify Args
                if (minNumSamples <= 0)
                    minNumSamples = 1;

                if (numSamples <= 0)
                    numSamples = 10;

                try
                {
                    if (!Directory.Exists(outputDirectory))
                        Directory.CreateDirectory(outputDirectory);
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Failed to create output Directory:\n" + outputDirectory);
                }
            }

            catch (Exception ex)
            {
                throw new ArgumentException("Failed to parse Arguments: " + ex.Message);
            }

            this.Text = "Analyzer Instance: " + runName;
            this.labelFolder.Text = folderPath;
            this.labelMinSamples.Text = minNumSamples.ToString();
            this.labelNumSamples.Text = numSamples.ToString();
            this.labelRunName.Text = runName;
            this.labelTimeStep.Text = timeStepMS + " ms";
        }