lib/advance.rb in advance-0.4.5 vs lib/advance.rb in advance-0.4.6
- old
+ new
@@ -35,17 +35,25 @@
puts "Multi steps will use #{$cores} cores"
$verbose_logging = case ENV["ADVANCE_VERBOSE_LOGGING"]
when "true"; true
when "false"; false
- when nil
- puts "For detailed logging of multi steps, rerun after 'export ADVANCE_VERBOSE_LOGGING=true'"
- false
+ when nil; false
else
puts "env variable ADVANCE_VERBOSE_LOGGING should be 'true', 'false', or not present (defaults to 'false')"
puts "currently set to >#{ENV["ADVANCE_VERBOSE_LOGGING"]}<"
+ false
end
+ $save_history = case ENV["ADVANCE_SAVE_HISTORY"]
+ when "true"; true
+ when "false"; false
+ when nil; true
+ else
+ puts "env variable ADVANCE_SAVE_HISTORY should be 'true', 'false', or not present (defaults to 'true')"
+ puts "currently set to >#{ENV["ADVANCE_SAVE_HISTORY"]}<"
+ true
+ end
end
def update_meta(step_number, processing_mode, label, command, start_time, duration, file_count)
meta =
if File.exist?(".meta")
@@ -130,10 +138,10 @@
duration = Time.now - start_time
update_meta($step, processing_mode, label, command, start_time, duration, file_count)
end
previous_dir_path = previous_dir_path.gsub(/\.tgz$/, "")
if File.basename(previous_dir_path) =~ /^step_/
- if !File.exist?("#{previous_dir_path}.tgz")
+ if $save_history && !File.exist?("#{previous_dir_path}.tgz")
do_command_wo_log "tar czf #{previous_dir_path}.tgz #{File.basename(previous_dir_path)}"
end
do_command_wo_log "rm -rf #{previous_dir_path}"
end
end