advance 0.4.3 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 341c54201a649459fbd7f7c3e2900f9f27045759560919a0c583d19088e40577
4
- data.tar.gz: 4f62f027c8cf2f5b35f48220a1243cf356274136600390cf8a5a40b9e2a34fa0
3
+ metadata.gz: 0dff13c708f480234a0e209cd4cedcfff790f180894447681a064e7973211412
4
+ data.tar.gz: c27f9f4a5f20c1748df540106286cdad9fc6581cef7d26426dec3275ed671b2f
5
5
  SHA512:
6
- metadata.gz: b476fb178dbaaf0ec54a48d7bb3d64ac9a754513f29096e2a4c5528edc2e28491dedf2dc63f983411063ed71f8d48163c32b2aed9e1787d87472fce6f02a5384
7
- data.tar.gz: 57e71827cc95371d9337558a8756497e0f6049e74648464e449ef459990a596b0345fac24841ae472262941ffe19a771f24e64749d917acfde8539f9a24d18db
6
+ metadata.gz: c2f4b67acf76dc75dbcc93724bdb05f60738ce1a6b16779d7f2ffed6f3bfe1759c4fea05ff726af83be0f6bec77f1888ecfd6214758d3efece44f30fdbe9d4f6
7
+ data.tar.gz: aae16995c3cc409f4f51ad6bf53dae7cdfa4f834355f8debc87af806a87fbbf0548b58fae9c486da08de250c8c2e2047254a52ab6ccd98b89ecd9e4338ab0146
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  .idea
10
10
  .ruby-gemset
11
11
  .ruby-version
12
+ .DS_Store
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- advance (0.4.2)
4
+ advance (0.4.8)
5
5
  team_effort
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  minitest (5.10.1)
11
- rake (10.4.2)
12
- team_effort (1.0.1)
11
+ rake (13.0.1)
12
+ team_effort (1.1.1)
13
13
 
14
14
  PLATFORMS
15
15
  ruby
@@ -18,7 +18,7 @@ DEPENDENCIES
18
18
  advance!
19
19
  bundler (~> 1.16)
20
20
  minitest (~> 5.0)
21
- rake (~> 10.0)
21
+ rake (~> 13.0)
22
22
 
23
23
  BUNDLED WITH
24
24
  1.17.3
@@ -30,6 +30,6 @@ step become the input to the next step.
30
30
 
31
31
  spec.add_runtime_dependency "team_effort"
32
32
  spec.add_development_dependency "bundler", "~> 1.16"
33
- spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rake", "~> 13.0"
34
34
  spec.add_development_dependency "minitest", "~> 5.0"
35
35
  end
@@ -9,13 +9,15 @@ end
9
9
  csv_file = ARGV[0]
10
10
  lines = ARGV[1]
11
11
  csv_file_name = File.basename(csv_file)
12
- system "head -n 1 #{csv_file} > #{csv_file_name}_header"
12
+ header_file_name = "#{csv_file_name}_header"
13
+ system "head -n 1 #{csv_file} > #{header_file_name}"
13
14
  system "tail -n +2 #{csv_file} | split -l #{lines} -a 3 - #{csv_file_name}_"
14
- files = Dir.entries(".").reject { |f| f =~ %r{^(\.\.?|log)$} }
15
+ files = Dir.entries(".").reject { |f| f.end_with?(header_file_name) || f =~ %r{^(\.\.?|log)$} }
15
16
  TeamEffort.work(files, 1) do |file|
16
17
  tmp_file = "tmp_#{file}"
17
- do_cmd "cat #{csv_file_name}_header #{file} >> #{tmp_file}"
18
+ do_cmd "cat #{header_file_name} #{file} >> #{tmp_file}"
18
19
  do_cmd "mv #{tmp_file} #{file}"
19
20
  end
20
- do_cmd "rm #{csv_file_name}_header"
21
+ do_cmd "rm #{header_file_name}"
22
+ do_cmd "rename 's/^(.*)\.csv_(.*)$/$1_$2.csv/' *csv*"
21
23
  puts ""
@@ -21,6 +21,18 @@ module Advance
21
21
  WHITE="\e[1;37m"
22
22
  YELLOW="\e[33m"
23
23
 
24
+ def env_is?(env_var_name, default)
25
+ case ENV[env_var_name]
26
+ when "true"; true
27
+ when "false"; false
28
+ when nil; default
29
+ else
30
+ puts "env variable #{env_var_name} should be 'true', 'false', or not present (defaults to '#{default}')"
31
+ puts "currently set to >#{ENV[env_var_name]}<"
32
+ false
33
+ end
34
+ end
35
+
24
36
  def self.included(pipeline_module)
25
37
  $pipeline = caller_locations.first.path
26
38
  meta =
@@ -33,17 +45,6 @@ module Advance
33
45
  $run_number = last_run_number + 1
34
46
  $cores=`nproc`.to_i
35
47
  puts "Multi steps will use #{$cores} cores"
36
-
37
- $verbose_logging = case ENV["ADVANCE_VERBOSE_LOGGING"]
38
- when "true"; true
39
- when "false"; false
40
- when nil
41
- puts "For detailed logging of multi steps, rerun after 'export ADVANCE_VERBOSE_LOGGING=true'"
42
- false
43
- else
44
- puts "env variable ADVANCE_VERBOSE_LOGGING should be 'true', 'false', or not present (defaults to 'false')"
45
- puts "currently set to >#{ENV["ADVANCE_VERBOSE_LOGGING"]}<"
46
- end
47
48
  end
48
49
 
49
50
  def update_meta(step_number, processing_mode, label, command, start_time, duration, file_count)
@@ -132,7 +133,7 @@ module Advance
132
133
  end
133
134
  previous_dir_path = previous_dir_path.gsub(/\.tgz$/, "")
134
135
  if File.basename(previous_dir_path) =~ /^step_/
135
- if !File.exist?("#{previous_dir_path}.tgz")
136
+ if env_is?("ADVANCE_SAVE_HISTORY", true) && !File.exist?("#{previous_dir_path}.tgz")
136
137
  do_command_wo_log "tar czf #{previous_dir_path}.tgz #{File.basename(previous_dir_path)}"
137
138
  end
138
139
  do_command_wo_log "rm -rf #{previous_dir_path}"
@@ -235,10 +236,11 @@ module Advance
235
236
  command.gsub!("{input_file}", file_path)
236
237
  command.gsub!("{file_name}", basename)
237
238
  command.gsub!("{file_name_without_extension}", root_file_name)
238
- puts "#{YELLOW}#{command}#{RESET} " if $verbose_logging
239
+ puts "#{YELLOW}#{command}#{RESET} " if env_is?("ADVANCE_VERBOSE_LOGGING", false)
239
240
  work_in_sub_dir(new_dir_name) do
240
- do_command command, $verbose_logging
241
+ do_command command, env_is?("ADVANCE_VERBOSE_LOGGING", false)
241
242
  end
243
+ do_command_wo_log "rm #{file_path}" if !env_is?("ADVANCE_SAVE_HISTORY", true)
242
244
  rescue
243
245
  puts "%%%% error while processing >>#{file_path}<<"
244
246
  raise
@@ -308,7 +310,7 @@ module Advance
308
310
  end
309
311
 
310
312
  def do_command(command, feedback = true)
311
- puts "#{YELLOW}#{command}#{RESET} " #if feedback
313
+ puts "#{YELLOW}#{command}#{RESET} " if feedback
312
314
  start_time = Time.now
313
315
  stdout, stderr, status = Open3.capture3(command)
314
316
  elapsed_time = Time.now - start_time
@@ -1,3 +1,3 @@
1
1
  module Advance
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - janemacfarlane
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-22 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: team_effort
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ homepage: https://github.com/doctorjane/advance
106
106
  licenses:
107
107
  - MIT
108
108
  metadata: {}
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -121,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.7.9
126
- signing_key:
124
+ rubygems_version: 3.0.6
125
+ signing_key:
127
126
  specification_version: 4
128
127
  summary: A framework for building data transformation pipelines
129
128
  test_files: []