public static void RecordedBulkParallelByChunks( AFTimeRange timeRange, int maxDegOfParallel, int bulkParallelChunkSize, int bulkPageSize, bool insertNoData, Action <List <AFValue> > insertData, PIPointsProvider provider, int sleep, CancellationToken cancelToken ) { int i = 0; foreach (var pointsChunk in provider.GetPointsByChunks(bulkParallelChunkSize)) { i++; _logger.InfoFormat("Processing tag chunk {0} - (tag chunk size: {1})", i, bulkParallelChunkSize); var pointsList = new PIPointList(pointsChunk); RecordedBulkParallel(pointsList, timeRange, 4, bulkParallelChunkSize, bulkPageSize, insertNoData, insertData, cancelToken); if (sleep > 0) { Thread.Sleep(sleep); } } }
public static void RecordedBulkByChunks( AFTimeRange timeRange, int pointsChunkSize, bool insertNoData, Action <List <AFValue> > insertData, PIPointsProvider provider, int sleep, CancellationToken cancellationToken ) { int i = 0; foreach (var pointsChunk in provider.GetPointsByChunks(pointsChunkSize)) { i++; _logger.InfoFormat("Processing tag chunk {0} - (tag chunk size: {1})", i, pointsChunkSize); var pointsList = new PIPointList(pointsChunk); RecordedBulk(pointsList, timeRange, pointsChunkSize, insertNoData, insertData); // todo needs a different setting here if (sleep > 0) { Thread.Sleep(sleep); } } }
private static void Main(string[] args) { TextWriter writer = Console.Out; try { var options = new CommandLineOptions(); if (Parser.Default.ParseArguments(args, options)) { if (args.Length <= 1) { Console.Write(options.GetUsage()); } if (options.Run != null && ValidateRunOptions(options.Run)) { _logger.Info("Option Run starting, will run the data replay continuously as a command line application."); var replayer = new Replayer(); replayer.RunFromCommandLine(options.Run[0], options.Run[1]); } if (options.deleteHistory != null && ValidateDeleteHistoryOptions(options.deleteHistory)) { _logger.Info("Delete History Option Selected, will deleted the specified data."); _logger.Info("This operation cannot be reversed, are you sure you want to delete the data you specified? Press Y to continue..."); var keyInfo = Console.ReadKey(); if (keyInfo.KeyChar != 'Y') { _logger.Info("Operation canceled"); } // getting the tags var piConnection = new PIConnection(options.deleteHistory[0]); piConnection.Connect(); var pointsProvider = new PIPointsProvider(options.deleteHistory[3], piConnection.GetPiServer()); foreach (var piPoint in pointsProvider.Points) { var st = AFTime.Parse(options.deleteHistory[1]); var et = AFTime.Parse(options.deleteHistory[2]); _logger.InfoFormat("Deleting history for tag: {0} between {1:G} and {2:G}", piPoint.Name, st.LocalTime, et.LocalTime); PIHelpers.DeleteValues(piPoint, st, et, options.ForceUpdateValuesMethod); } } } else { options.GetUsage(); } } catch (Exception ex) { Console.SetOut(writer); Console.WriteLine("Error: " + ex); } }