petasos 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d13f219555d9e62adf300ef1f708222955c8ebec955e64843a679624c53fc2f1
4
- data.tar.gz: b24a1fd6cf6f055f9340d28aa06de4b7096f7a363d7c617daeaf3e2fb0838b96
3
+ metadata.gz: cb623c372e4177df95553923e61d111337bb01b28ace724d443d2a2014631ad2
4
+ data.tar.gz: b914c31bbd9c6743f662c051b881ca9e9195542e5ec6b7b1c8890b33496470a6
5
5
  SHA512:
6
- metadata.gz: 135cf3a94737ec8a8d13e824c3c20c4c4c6f7089ed6d279c9339109d5f346d877a697dded2f2f11147c375527a8ca8d3a13f15ae77a718592d121838521d0385
7
- data.tar.gz: 385e42e07d43317eb4aac5d9082bb195ad79c664e26e5770bdb60a976f9737fe1ff99f167bcd5c57da6ddbfde06d34e6f96bd40cd1ab5b99cae238140a372c4c
6
+ metadata.gz: 8882b063964e50f3c3e6109d652eedac094c619007d173760ccc769c2452b86ab875b1355c5434d431e20a1e634624dd642207484f76d1c13de6bcc96ceaa03d
7
+ data.tar.gz: 5e545b2c1fbe779f1effa4641fe3fa93b5f46aa60611bacaae6e24d9b57a5809fe5bac79c17ab5f996dfa80a62dfe2258b6289faa3ba9a817653b81f43e1adfd
@@ -17,11 +17,6 @@ class Petasos::Distributor
17
17
  @nodes[node["name"]] = Petasos::Node.new(node)
18
18
  end
19
19
 
20
- @nodes.values.each do |node|
21
- puts "Running `petasos locations` on #{node.name} before distribution begins"
22
- `ssh #{node.host} \"cd #{node.path} && petasos locations\"`
23
- end
24
-
25
20
  @manifests = {}
26
21
  @nodes.each_pair do |node_name, node|
27
22
  @manifests[node_name] = node.manifests
@@ -88,7 +83,7 @@ class Petasos::Distributor
88
83
  destination_seen_file_hash = get_seen_file_hash(pool_storage.first, pool_storage[1], pool_name)
89
84
  export_paths.each do |export_path|
90
85
  unless destination_seen_file_hash[File.basename(export_path)]
91
- puts "moving #{File.basename(export_path)} from #{from_node.name} to #{to_node.name}"
86
+ puts "exporting #{File.basename(export_path)} from #{from_node.name} to #{to_node.name}"
92
87
  `scp #{from_node.host}:#{export_path}* #{to_node.host}:#{pool_storage.last}`
93
88
  end
94
89
  end
@@ -101,6 +96,8 @@ class Petasos::Distributor
101
96
  # and then put it back where it came from
102
97
  `scp #{completed_export_file_path} #{from_node.host}:#{from_node.path}`
103
98
  `rm #{completed_export_file_path}`
99
+ puts "Running `petasos locations` on #{from_node.name} after completing its exports"
100
+ `ssh #{from_node.host} \"cd #{from_node.path} && petasos locations\"`
104
101
  end
105
102
 
106
103
  # {"wow-ah"=>
@@ -115,6 +112,7 @@ class Petasos::Distributor
115
112
 
116
113
  # Process the backfills.
117
114
  @pools.each_pair do |pool_name, manifest_hash|
115
+ `mkdir -p petasos_distributor_workspace`
118
116
  # for each canonical exporter loop through the backfill lists, identify files that need moving and move them
119
117
  manifest_hash["canonical_exporters"].each do |canonical_exporter_details|
120
118
  exporter_seen_files = get_seen_file_hash(canonical_exporter_details.first, canonical_exporter_details.last, pool_name)
@@ -137,15 +135,15 @@ class Petasos::Distributor
137
135
  end
138
136
  end
139
137
  # clear the seen files locally.
140
- `rm seen_*`
138
+ `rm petasos_distributor_workspace/*`
141
139
  end
142
140
 
143
141
  def get_seen_file_hash(node_name, location_name, pool_name)
144
142
  find_node(node_name).grab_seen_file_for_location(location_name, pool_name)
145
143
  seen_file_hash = {}
146
144
  # some locations/pools do not generate a seen file.
147
- if File.file?("seen_#{location_name}_#{pool_name}.yaml")
148
- seen_file_list = YAML.load_file("seen_#{location_name}_#{pool_name}.yaml")
145
+ if File.file?("petasos_distributor_workspace/seen_#{location_name}_#{pool_name}.yaml")
146
+ seen_file_list = YAML.load_file("petasos_distributor_workspace/seen_#{location_name}_#{pool_name}.yaml")
149
147
  else
150
148
  seen_file_list = []
151
149
  end
@@ -144,12 +144,12 @@ class Petasos::Location
144
144
  end
145
145
  end
146
146
 
147
- def clear_all_seen_pool_files
148
- pools.each do |pool|
149
- yaml_path = File.join(path, "seen_#{pool["name"]}.yaml")
150
- write_yaml(yaml_path, [])
151
- end
152
- end
147
+ # def clear_all_seen_pool_files
148
+ # pools.each do |pool|
149
+ # yaml_path = File.join(path, "seen_#{pool["name"]}.yaml")
150
+ # write_yaml(yaml_path, [])
151
+ # end
152
+ # end
153
153
 
154
154
  def create_file_export_list(pool, file_paths)
155
155
  yaml_path = File.join(Dir.pwd, "exports_#{@config["name"]}_#{pool["name"]}_#{Time.now.strftime("%Y-%m-%d-%H:%M:%S")}.yaml")
data/lib/petasos/node.rb CHANGED
@@ -10,6 +10,10 @@ class Petasos::Node
10
10
  @config = config
11
11
  @manifests = []
12
12
  `mkdir -p #{config["name"]}`
13
+
14
+ puts "Running `petasos locations` on #{name} before distribution begins"
15
+ `ssh #{host} \"cd #{path} && petasos locations\"`
16
+
13
17
  grab_manifest_and_exports
14
18
  parse_manifests
15
19
  end
@@ -35,7 +39,7 @@ class Petasos::Node
35
39
  end
36
40
 
37
41
  def grab_seen_file_for_location(location_name, pool_name)
38
- `scp #{config["host"]}:#{config["path"]}/seen_#{location_name}_#{pool_name}.yaml .`
42
+ `scp #{config["host"]}:#{config["path"]}/seen_#{location_name}_#{pool_name}.yaml petasos_distributor_workspace/`
39
43
  end
40
44
 
41
45
  def parse_manifests
data/lib/petasos.rb CHANGED
@@ -7,9 +7,14 @@ class Petasos
7
7
  class Error < StandardError; end
8
8
 
9
9
  def run(mode = "")
10
- process_locations
11
- unless mode == "locations"
12
- process_distribution if File.file?(File.join(Dir.pwd, "petasos_distribution-config.yaml"))
10
+ unless File.file?("petasos_is_running")
11
+ `touch petasos_is_running`
12
+ process_locations
13
+ unless mode == "locations"
14
+ process_distribution if File.file?(File.join(Dir.pwd, "petasos_distribution-config.yaml"))
15
+ process_locations
16
+ end
17
+ `rm petasos_is_running`
13
18
  end
14
19
  end
15
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petasos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Myers