-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestclient_raxml.rb
More file actions
67 lines (43 loc) · 1.35 KB
/
restclient_raxml.rb
File metadata and controls
67 lines (43 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# restclient_raxml.rb
require 'rubygems'
require 'rest_client'
require 'json'
#step 1:: parse the parameters
filename = ''
modelofevolution = ''
numberofruns = ''
wtaskid = ''
ARGV.each do |a|
#puts a
#puts 'ARGV.index(a):: ' + ARGV.index(a).to_s
if a == "-s"
filename = ARGV[ARGV.index(a)+1]
end
if a == "-m"
puts a
modelofevolution = ARGV[ARGV.index(a)+1]
end
if a == "-#"
puts a
numberofruns = ARGV[ARGV.index(a)+1]
end
if a == "-wtaskid"
wtaskid = ARGV[ARGV.index(a)+1]
end
end
puts 'filename :: ' + filename
puts 'modelofevolution :: ' + modelofevolution
puts 'numberofruns :: ' + numberofruns
response = RestClient.post 'http://10.243.11.78:3000/raxmls', :fileParam => File.new(filename, 'rb'), :modelofevolution => modelofevolution, :numberofruns => numberofruns, :wtaskid => wtaskid
puts 'REST Response :: ' + response.body
#return 'REST Response :: ' + response.body
#step 2:: save the result folder
#copy the folder back to workflow folder?
#Or just record/save the job_id?
#if job_ib exists -> means this task is successfully running
#Update this task's status from 'initial' to 'done'
#@wtask = Wtask.find(wtaskid)
#@wtask.update_attribute('wtask_status', 'done')
#save the job_id to table::wtasks
#copy the completed alignment file back to workflow folder
#@wtask.update_attribute('wtask_folder', '1234')