xp5k 0.0.16 → 0.0.17

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xp5k/version.rb +1 -1
  3. data/lib/xp5k/xp.rb +14 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4af38fdece7ea8f615a9c32761543028f78867e9
4
- data.tar.gz: 64bd6b858b83263d93ab18cbb2a30a016e5e582b
3
+ metadata.gz: 72e46598f1022b3d7583ebd9eb2f56daaefd26ec
4
+ data.tar.gz: 13cd313c3f4ec4152c1ae9e5184b2622907678ac
5
5
  SHA512:
6
- metadata.gz: 1eef9aa31c0937cb54ad9e199e356d5fe9a66f274169ea1ab559a3358372de3066e67710bb272ea0cfe679e7f494782cdfd871db71804cf8498805a71b33bd1c
7
- data.tar.gz: 30b377ef199f06815dd5e5c8dca6ea3d4446b61ffb7e2070485fec138dcfd4fac4b04fe652b2bf11ad4bad720ebb880418d542a3365c159c06bbf98d6fb4d375
6
+ metadata.gz: 0b74f1a0855cc0bd9f75828dc84fcd2a2c3372a1393caa1738eb37ae8d7c77309a79fc76892db9525fcc5e5003c9b23d43c5588275b8b7db071c7a3d59bc97b9
7
+ data.tar.gz: 7041f61aee8d3b29f02261c9fd7e9bc559e1cab0acc1fb5a14089e79856dd02759ee44e99a22de40b7db3f2b4b04a0f01a4409546b96720f82f7c2bac16c746d
data/lib/xp5k/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module XP5K
2
- VERSION='0.0.16'
2
+ VERSION='0.0.17'
3
3
  end
data/lib/xp5k/xp.rb CHANGED
@@ -81,7 +81,9 @@ module XP5K
81
81
  if File.exists?(".xp_cache") or job_hash[:jobid]
82
82
  uid = job_hash[:jobid] || begin
83
83
  datas = JSON.parse(File.read(".xp_cache"))
84
- datas["jobs"].select { |x| x["name"] == job_hash[:name] }.first["uid"]
84
+ job = datas["jobs"].select { |x| x["name"] == job_hash[:name] }.first
85
+ job ? job["uid"] : nil
86
+ #datas["jobs"].select { |x| x["name"] == job_hash[:name] }.first["uid"]
85
87
  end
86
88
  unless uid.nil?
87
89
  job = @connection.root.sites[job_hash[:site].to_sym].jobs(:query => { :user => @connection.config.options[:username] || ENV['USER'] })["#{uid}".to_sym]
@@ -89,12 +91,12 @@ module XP5K
89
91
  j = job.reload
90
92
  self.jobs << j
91
93
  self.roles += Role.create_roles(j, job_hash) unless job_hash[:roles].nil?
92
- update_cache()
93
94
  end
94
95
  end
95
96
  # reload last deployed nodes
96
97
  self.deployed_nodes = datas["deployed_nodes"] if datas
97
98
  end
99
+ #update_cache()
98
100
 
99
101
  end
100
102
 
@@ -102,10 +104,15 @@ module XP5K
102
104
  self.jobs2submit.each do |job2submit|
103
105
  job = self.job_with_name(job2submit[:name])
104
106
  if job.nil?
105
- job = @connection.root.sites[job2submit[:site].to_sym].jobs.submit(job2submit)
106
- update_cache
107
- logger.info "Job \"#{job['name']}\" submitted with id #{job['uid']}@#{job2submit[:site]}"
108
- self.jobs << job
107
+ begin
108
+ job = @connection.root.sites[job2submit[:site].to_sym].jobs.submit(job2submit)
109
+ logger.info "Job \"#{job['name']}\" submitted with id #{job['uid']}@#{job2submit[:site]}"
110
+ self.jobs << job
111
+ update_cache
112
+ rescue Exception => e
113
+ puts "Error with job #{job2submit}"
114
+ puts e.message
115
+ end
109
116
  else
110
117
  logger.info "Job \"#{job["name"]}\" already submitted #{job["uid"]}@#{job2submit[:site]}"
111
118
  end
@@ -169,6 +176,7 @@ module XP5K
169
176
  log += " (until #{Time.at(job['started_at'].to_i + job['walltime'].to_i).to_datetime})" if job['state'] == 'running'
170
177
  logger.info log
171
178
  end
179
+ update_cache
172
180
  end
173
181
 
174
182
  def clean
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xp5k
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Morillon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack