From fa872b1b6560741bbc258db69ce0e536b3fc4d13 Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Mon, 16 Oct 2017 10:13:55 -0400 Subject: [PATCH] introducing stop index --- lib/tasks/data.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index 37d418f0..b4c7fd4f 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -147,6 +147,7 @@ namespace :data do timeToRun = 100 * 60 * 60 startIndex = 0 + stopIndex = 1000 startTime = Time.new ['student_responses', 'teacher_responses'].each do |file| @@ -160,12 +161,12 @@ namespace :data do csv.each_with_index do |row, index| next if index < startIndex - if Time.new - startTime >= timeToRun + if Time.new - startTime >= timeToRun || index > stopIndex puts("ENDING #{timeToRun} SECONDS: #{Time.new - startTime} = #{startIndex} -> #{index} = #{index - startIndex} or #{(Time.new - t) / (index - startIndex)} per second") break end - if index % 100 == 0 + if index % 10 == 0 puts("DATAMSG: PROCESSING ROW: #{index} OUT OF #{csv.length} ROWS: #{Time.new - t} - Total: #{Time.new - startTime} - #{timeToRun - (Time.new - startTime)} TO GO") t = Time.new end