petasos 0.5.1 → 0.5.3

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: 4ff98d0ee0f69c09a8436007524d6650b8ed5e82c4f2ced088b0a8da72ac31cd
4
- data.tar.gz: 4e16bc991db6f87baa0f056e64834251749c290b3e6aba9db66586ff6850a2fb
3
+ metadata.gz: aa99f3e5d9f11e0330a51234fbfa8ed194368cf471a3d70306e4751fdd716e79
4
+ data.tar.gz: dd22a538aab970b00ab9535c034ff07c44562b6d80fd7bf7b6abaf461bcacfb2
5
5
  SHA512:
6
- metadata.gz: d0cc807729014a25f679cfadddcc8ee6851b2312438790e193ebd4b38ce9182d1a4ee4a0d0da07685eee1b125671841f1b7758b1708699d6b2328bd8ea74bab8
7
- data.tar.gz: 9b44f27902559d5b0d3df48ab822186d3de4f28627b86a0f1288000e4d1e61ad7985348ea6efaf03bb94d9ba654941b48ec72a2febe6d851d5825b83753c3f46
6
+ metadata.gz: fba6de2e29d35efcba72bed8d2fe2afad5b63aa45aab4d1924da9e81e6ea9e6916984ecdf4b0ee3a06bc7d15a66279267a0cda77596f85955ca1092f2fb59625
7
+ data.tar.gz: b2f040050ae79ca54120ed1aabc94b0933ab9258a685f51129b5e5d04b09b0a6b9cdf79da88391ffd8fcd320ba5010004baf394f370c1330d80a0e3ccff45b2d
@@ -112,6 +112,7 @@ class Petasos::Distributor
112
112
 
113
113
  # Process the backfills.
114
114
  @pools.each_pair do |pool_name, manifest_hash|
115
+ `mkdir -p petasos_distributor_workspace`
115
116
  # for each canonical exporter loop through the backfill lists, identify files that need moving and move them
116
117
  manifest_hash["canonical_exporters"].each do |canonical_exporter_details|
117
118
  exporter_seen_files = get_seen_file_hash(canonical_exporter_details.first, canonical_exporter_details.last, pool_name)
@@ -134,15 +135,15 @@ class Petasos::Distributor
134
135
  end
135
136
  end
136
137
  # clear the seen files locally.
137
- `rm seen_*`
138
+ `rm petasos_distributor_workspace/*`
138
139
  end
139
140
 
140
141
  def get_seen_file_hash(node_name, location_name, pool_name)
141
142
  find_node(node_name).grab_seen_file_for_location(location_name, pool_name)
142
143
  seen_file_hash = {}
143
144
  # some locations/pools do not generate a seen file.
144
- if File.file?("seen_#{location_name}_#{pool_name}.yaml")
145
- 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")
146
147
  else
147
148
  seen_file_list = []
148
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
@@ -39,7 +39,7 @@ class Petasos::Node
39
39
  end
40
40
 
41
41
  def grab_seen_file_for_location(location_name, pool_name)
42
- `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/`
43
43
  end
44
44
 
45
45
  def parse_manifests
data/lib/petasos.rb CHANGED
@@ -7,14 +7,30 @@ class Petasos
7
7
  class Error < StandardError; end
8
8
 
9
9
  def run(mode = "")
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"))
10
+ if mode == "locations"
11
+ lock_and_run("locations") do
15
12
  process_locations
16
13
  end
17
- `rm petasos_is_running`
14
+ elsif mode == "distribution"
15
+ lock_and_run("distribution") do
16
+ process_distribution
17
+ end
18
+ else # mode is neither distribution or locations
19
+ lock_and_run("locations") do
20
+ process_locations
21
+ end
22
+ lock_and_run("distribution") do
23
+ process_distribution
24
+ end
25
+ end
26
+ end
27
+
28
+ def lock_and_run(mode, &block)
29
+ lock_filename = "petasos_is_running_#{mode}"
30
+ if !File.file?(lock_filename)
31
+ `touch #{lock_filename}`
32
+ yield
33
+ `rm #{lock_filename}`
18
34
  end
19
35
  end
20
36
 
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.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Myers