bio-polymarker_db_batch 0.3.2 → 0.4.0
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 +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/bin/monitor_running_polymarker.rb +8 -11
- data/bin/run_pending_polymarker.rb +2 -0
- data/lib/bio-polymarker_db_batch/polymarker_db_batch.rb +62 -8
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34300c3ab7db4b1aa97f72a1eb129b132cb2f151
|
4
|
+
data.tar.gz: 1c2793e119d6fb7db7a8e1fcd8f2038d1e769d5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c969309580aefa5b53d02760719ecb8356732698095ec8f0937a1a0aa0a5af900f7586eece85c4f7cc5fdfcaf6671e8c138cf3f0854af342e1203fc12174e09
|
7
|
+
data.tar.gz: d3a7b2b7a6372fe5e982923eea9a0a8d1693e157dc9788ea0d2c79c05aaddd8dd98611b95cc946e0132658d671bd5abeea64719d057daf53e199b68f39ff6b53
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -23,19 +23,16 @@ end.parse!
|
|
23
23
|
pol=Bio::DB::Polymarker.new(options[:preferences])
|
24
24
|
|
25
25
|
|
26
|
-
pol.mysql_version
|
26
|
+
#pol.mysql_version
|
27
27
|
pol.each_running do |row|
|
28
|
-
puts row.join(",")
|
29
|
-
puts row.inspect
|
30
|
-
pol.review_running_status(row[0], row[1])
|
31
|
-
# pol.write_output_file_and_execute(row[0], row[1]);
|
32
|
-
# pol.each_snp_in_file(row[0]) do |snp|
|
33
|
-
# puts snp.inspect
|
34
|
-
|
35
|
-
# pol.
|
36
|
-
#end
|
37
|
-
|
28
|
+
#puts row.join(",")
|
29
|
+
#puts row.inspect
|
30
|
+
pol.review_running_status(row[0], row[1])
|
38
31
|
end
|
39
32
|
|
33
|
+
pol.each_timeout do |row|
|
34
|
+
#puts "Timeouts: #{row[0]}"
|
35
|
+
pol.update_error_status(row[0], "Timeout")
|
36
|
+
end
|
40
37
|
|
41
38
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'pp'
|
2
2
|
class Bio::DB::Polymarker
|
3
3
|
|
4
4
|
|
@@ -38,6 +38,19 @@ class Bio::DB::Polymarker
|
|
38
38
|
ret
|
39
39
|
end
|
40
40
|
|
41
|
+
def each_timeout
|
42
|
+
#TODO: validate the timeouts.
|
43
|
+
#SELECT * FROM snp_file WHERE datediff(NOW(), lastChange) > 3 and status != 'DONE';
|
44
|
+
query="SELECT snp_file_id, filename FROM snp_file WHERE datediff(NOW(), submitted) > 3 AND status IN ('NEW', 'SUBMITTED', 'RUNNING');"
|
45
|
+
ret = 0
|
46
|
+
if block_given?
|
47
|
+
ret = execute_query(query){|row| yield row }
|
48
|
+
else
|
49
|
+
ret = execute_query(query)
|
50
|
+
end
|
51
|
+
ret
|
52
|
+
end
|
53
|
+
|
41
54
|
def each_snp_in_file(file_id)
|
42
55
|
query="SELECT name, chromosome, sequence FROM snp, snp_file_snp WHERE snp_file_snp.snpList_snpId = snp.snpId AND snp_file_snp.snp_file_snp_file_id = '#{file_id}' AND snp.process = 1;"
|
43
56
|
ret = 0
|
@@ -51,6 +64,7 @@ class Bio::DB::Polymarker
|
|
51
64
|
end
|
52
65
|
|
53
66
|
def write_output_file_and_execute(file_id, filename)
|
67
|
+
puts "Writting: #{file_id}_#{filename}"
|
54
68
|
path =@properties["execution_path"]+"/#{file_id}_#{filename}"
|
55
69
|
puts "Writting: #{path}"
|
56
70
|
f=File.open(path, "w")
|
@@ -80,7 +94,31 @@ class Bio::DB::Polymarker
|
|
80
94
|
hashed_id = "#{snp_file_id}:#{snp_file['hash']}"
|
81
95
|
send_email(snp_file['email'],hashed_id, new_status)
|
82
96
|
rescue
|
83
|
-
puts "Error sending email."
|
97
|
+
puts "Error sending email. "
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def update_error_status(snp_file_id, error_message)
|
102
|
+
snp_file = get_snp_file(snp_file_id)
|
103
|
+
return if snp_file['status'] == "ERROR"
|
104
|
+
|
105
|
+
|
106
|
+
pst = con.prepare "UPDATE snp_file SET status = 'ERROR', error=? WHERE snp_file_id = ?"
|
107
|
+
puts "update_error_status: #{pst}"
|
108
|
+
pst.execute error_message, snp_file_id
|
109
|
+
con.commit
|
110
|
+
new_status = "ERROR: #{error_message}"
|
111
|
+
hashed_id = "#{snp_file_id}:#{snp_file['hash']}"
|
112
|
+
begin
|
113
|
+
send_email(snp_file['email'], hashed_id, new_status)
|
114
|
+
rescue Exception => e
|
115
|
+
puts "Error sending email to #{snp_file['email']}: #{e.message}"
|
116
|
+
end
|
117
|
+
|
118
|
+
begin
|
119
|
+
send_email(@properties['email_from'], hashed_id, new_status)
|
120
|
+
rescue Exception => e
|
121
|
+
puts "Error sending email to #{@properties['email_from']}: #{e.message}"
|
84
122
|
end
|
85
123
|
end
|
86
124
|
|
@@ -109,17 +147,33 @@ END_OF_MESSAGE
|
|
109
147
|
started=File.exist?(out_folder)
|
110
148
|
done=false
|
111
149
|
|
150
|
+
|
151
|
+
error_message = ""
|
152
|
+
error = false
|
153
|
+
|
112
154
|
if started
|
113
155
|
lines = IO.readlines("#{out_folder}/status.txt")
|
114
|
-
|
115
|
-
|
156
|
+
puts lines.inspect
|
157
|
+
|
158
|
+
lines.each do |l|
|
159
|
+
done = l.split(",").include?("DONE\n")
|
160
|
+
end
|
161
|
+
|
162
|
+
lines.each do |l|
|
163
|
+
error = l.include?("ERROR") unless error
|
164
|
+
error_message << l if error
|
165
|
+
end
|
116
166
|
end
|
167
|
+
|
168
|
+
|
117
169
|
if done
|
118
170
|
exons_filename="#{out_folder}/exons_genes_and_contigs.fa"
|
119
171
|
output_primers="#{out_folder}/primers.csv"
|
120
172
|
read_file_to_snp_file("mask_fasta", file_id, exons_filename )
|
121
173
|
read_file_to_snp_file("polymarker_output", file_id, output_primers )
|
122
174
|
update_status(file_id, "DONE")
|
175
|
+
elsif error
|
176
|
+
update_error_status(file_id, error_message)
|
123
177
|
elsif started
|
124
178
|
update_status(file_id, "RUNNING")
|
125
179
|
end
|
@@ -151,13 +205,13 @@ END_OF_MESSAGE
|
|
151
205
|
end
|
152
206
|
|
153
207
|
def execute_query(query)
|
154
|
-
$stderr.puts query if $VERBOSE
|
155
|
-
|
156
|
-
|
157
|
-
|
208
|
+
$stderr.puts query if $VERBOSE
|
209
|
+
#puts "to execute: #{query}"
|
158
210
|
if query.start_with?( 'SELECT')
|
159
211
|
rs = con.query(query)
|
212
|
+
pp rs.inspect
|
160
213
|
n_rows = rs.num_rows
|
214
|
+
puts "Returned #{n_rows} rows"
|
161
215
|
ret = Array.new unless block_given?
|
162
216
|
n_rows.times do
|
163
217
|
row = rs.fetch_row
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-polymarker_db_batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo H. Ramirez-Gonzalez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bio-polyploid-tools
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.5.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.5.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mysql
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|