keep track of psych migration time

also make it runnable with ENV var

refs #CNVS-28417

Change-Id: Ic2c3cea224167dfb3b8bcfee4999b0d76540c1da
Reviewed-on: https://gerrit.instructure.com/76168
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2016-04-04 14:08:49 -06:00
parent ab13758d08
commit c24896df63
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,9 @@ class BeginPsychMigration < ActiveRecord::Migration
tag :postdeploy tag :postdeploy
def self.runnable? # TODO: Remove when we're ready to run this everywhere def self.runnable? # TODO: Remove when we're ready to run this everywhere
if ApplicationController.respond_to?(:test_cluster?) if ENV['RUN_PSYCH_MIGRATION']
true
elsif ApplicationController.respond_to?(:test_cluster?)
ApplicationController.test_cluster? ApplicationController.test_cluster?
else else
true true

View File

@ -37,6 +37,10 @@ module DataFixup::PsychMigration
end end
def migrate_yaml(progress, model, columns, start_at, end_at) def migrate_yaml(progress, model, columns, start_at, end_at)
if progress
progress.set_results(progress.results.merge(:time_started_at => Time.now.utc))
end
total_count = 0 total_count = 0
unparsable_count = 0 unparsable_count = 0
changed_count = 0 changed_count = 0
@ -93,7 +97,7 @@ module DataFixup::PsychMigration
end end
end end
if progress if progress
progress.set_results(progress.results.merge(:successful => true, :total_count => total_count, progress.set_results(progress.results.merge(:time_finished_at => Time.now.utc, :successful => true, :total_count => total_count,
:changed_count => changed_count, :unparsable_count => unparsable_count)) :changed_count => changed_count, :unparsable_count => unparsable_count))
end end
end end