myreplicator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/myreplicator/application.css +14 -0
- data/app/controllers/myreplicator/exports_controller.rb +1 -5
- data/app/controllers/myreplicator/home_controller.rb +6 -0
- data/app/models/myreplicator/export.rb +1 -1
- data/app/models/myreplicator/log.rb +5 -1
- data/app/views/myreplicator/home/index.html.erb +4 -0
- data/config/routes.rb +1 -0
- data/lib/loader/loader.rb +0 -1
- data/lib/myreplicator/version.rb +1 -1
- data/lib/transporter/transporter.rb +4 -4
- data/test/dummy/log/development.log +1080 -0
- data/test/dummy/tmp/cache/assets/CD5/B90/sprockets%2Fc999d13a6a21113981c0d820e8043bdf +0 -0
- data/test/dummy/tmp/cache/assets/D8B/B60/sprockets%2Faa32227c440a378ccd21218eefeb80bf +0 -0
- data/test/dummy/tmp/cache/assets/DF8/5D0/sprockets%2Fb815ed34d61cfed96222daa3bfd1d84d +0 -0
- data/test/dummy/tmp/myreplicator/okl_test_batchy_batches_1358276518.tsv.gz +0 -0
- data/test/dummy/tmp/myreplicator/okl_test_batchy_batches_1358276518.tsv.json +1 -0
- data/test/dummy/tmp/myreplicator/okl_test_batchy_batches_1358278078.tsv.gz +0 -0
- data/test/dummy/tmp/myreplicator/okl_test_batchy_batches_1358278078.tsv.json +1 -0
- metadata +44 -4
@@ -585,3 +585,17 @@ table.overview tr:nth-child(even) {background:#fbfbfb;}
|
|
585
585
|
table.overview tr:last-child td {border-bottom:0px;}
|
586
586
|
table.overview td span.name {color:#474747;display:block;font-weight:bold; font-size:13px;padding-bottom:5px;}
|
587
587
|
table.overview td span.file {color:#999;display:block;font-style:italic;}
|
588
|
+
a.kill {
|
589
|
+
color:#474747;
|
590
|
+
display:block;
|
591
|
+
float:right;
|
592
|
+
text-decoration:none;
|
593
|
+
text-shadow:0 1px #fff;
|
594
|
+
}
|
595
|
+
a.kill:before {
|
596
|
+
content: '`';
|
597
|
+
font-family: 'WebSymbolsRegular';
|
598
|
+
padding-right:3px;
|
599
|
+
font-size:14px;
|
600
|
+
}
|
601
|
+
a.kill:hover:before {color:#990000}
|
@@ -47,22 +47,18 @@ module Myreplicator
|
|
47
47
|
@edit = true
|
48
48
|
|
49
49
|
Myreplicator::Export.schedule_in_resque # schedule in resque
|
50
|
-
|
51
50
|
end
|
52
51
|
|
53
52
|
# POST /exports
|
54
53
|
# POST /exports.json
|
55
54
|
def create
|
56
55
|
@export = Export.new(params[:export])
|
57
|
-
|
58
|
-
Myreplicator::Export.schedule_in_resque # schedule in resque
|
59
|
-
|
60
56
|
@dbs = get_dbs
|
61
|
-
|
62
57
|
respond_to do |format|
|
63
58
|
if @export.save
|
64
59
|
format.html { redirect_to @export, notice: 'Export was successfully created.' }
|
65
60
|
format.json { render json: @export, status: :created, location: @export }
|
61
|
+
Myreplicator::Export.schedule_in_resque # schedule in resque
|
66
62
|
else
|
67
63
|
format.html { render action: "new" }
|
68
64
|
format.json { render json: @export.errors, status: :unprocessable_entity }
|
@@ -21,6 +21,12 @@ module Myreplicator
|
|
21
21
|
@exports = Export.where("error is not null").order('source_schema ASC')
|
22
22
|
@logs = Log.where(:state => 'error').order("started_at DESC")
|
23
23
|
end
|
24
|
+
|
25
|
+
def kill
|
26
|
+
@log = Log.find(params[:id])
|
27
|
+
@log.kill
|
28
|
+
redirect_to :action => 'index'
|
29
|
+
end
|
24
30
|
|
25
31
|
end
|
26
32
|
end
|
@@ -68,7 +68,11 @@ module Myreplicator
|
|
68
68
|
# Checks to see if the PID of the log is active or not
|
69
69
|
##
|
70
70
|
def running?
|
71
|
-
logs = Log.where(:file => file,
|
71
|
+
logs = Log.where(:file => file,
|
72
|
+
:job_type => job_type,
|
73
|
+
:state => "running",
|
74
|
+
:export_id => export_id,
|
75
|
+
:hostname => hostname)
|
72
76
|
|
73
77
|
if logs.count > 0
|
74
78
|
logs.each do |log|
|
@@ -12,6 +12,7 @@
|
|
12
12
|
<td><%= log.job_type %></td>
|
13
13
|
<td><%= log.started_at.strftime("%Y-%m-%d %H:%M:%S") %></td>
|
14
14
|
<td><%= chronos(@now.to_i - log.started_at.to_i) %></td>
|
15
|
+
<td><%= link_to 'kill job', kill_path(log), :class => 'kill'%></td>
|
15
16
|
</tr>
|
16
17
|
<% end %>
|
17
18
|
</table>
|
@@ -31,5 +32,8 @@ jQuery(function(){
|
|
31
32
|
link.addClass("on");
|
32
33
|
jQuery(link.attr('href')).fadeIn().siblings("li").hide();
|
33
34
|
})
|
35
|
+
$("a.kill").click(function(e){
|
36
|
+
if(confirm("Are you sure you wish to kill this running job?")!=true){e.preventDefault();}
|
37
|
+
})
|
34
38
|
})
|
35
39
|
</script>
|
data/config/routes.rb
CHANGED
data/lib/loader/loader.rb
CHANGED
data/lib/myreplicator/version.rb
CHANGED
@@ -38,8 +38,8 @@ module Myreplicator
|
|
38
38
|
# downloads export files concurrently from multiple sources
|
39
39
|
##
|
40
40
|
def self.transfer
|
41
|
-
unique_jobs = Export.where("
|
42
|
-
|
41
|
+
unique_jobs = Export.where("active = 1").group("source_schema")
|
42
|
+
|
43
43
|
unique_jobs.each do |export|
|
44
44
|
download export
|
45
45
|
end
|
@@ -60,7 +60,7 @@ module Myreplicator
|
|
60
60
|
##
|
61
61
|
def self.parallel_download export, ssh, files
|
62
62
|
p = Parallelizer.new(:klass => "Myreplicator::Transporter")
|
63
|
-
|
63
|
+
|
64
64
|
files.each do |filename|
|
65
65
|
puts filename
|
66
66
|
p.queue << {:params =>[ssh, export, filename], :block => download_file}
|
@@ -93,7 +93,7 @@ module Myreplicator
|
|
93
93
|
sftp.download!(json_file, json_local_path)
|
94
94
|
metadata = Transporter.metadata_obj(json_local_path)
|
95
95
|
dump_file = metadata.export_path
|
96
|
-
|
96
|
+
puts metadata.state
|
97
97
|
if metadata.state == "export_completed"
|
98
98
|
Log.run(:job_type => "transporter", :name => "export_file",
|
99
99
|
:file => dump_file, :export_id => export.id) do |log|
|