naf 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +28 -4
- data/RELEASE_NOTES.rdoc +8 -0
- data/app/assets/javascripts/dataTablesTemplates/application_schedules.js +72 -0
- data/app/assets/javascripts/dataTablesTemplates/applications.js +12 -21
- data/app/controllers/naf/application_schedule_affinity_tabs_controller.rb +5 -8
- data/app/controllers/naf/application_schedules_controller.rb +98 -0
- data/app/controllers/naf/applications_controller.rb +6 -98
- data/app/controllers/naf/historical_jobs_controller.rb +18 -8
- data/app/helpers/naf/application_helper.rb +47 -22
- data/app/models/logical/naf/application.rb +9 -126
- data/app/models/logical/naf/application_schedule.rb +186 -0
- data/app/models/logical/naf/construction_zone/boss.rb +4 -5
- data/app/models/logical/naf/construction_zone/foreman.rb +34 -13
- data/app/models/logical/naf/construction_zone/proletariat.rb +1 -0
- data/app/models/logical/naf/construction_zone/work_order.rb +11 -4
- data/app/models/logical/naf/job_fetcher.rb +1 -0
- data/app/models/naf/application.rb +5 -16
- data/app/models/naf/application_schedule.rb +117 -43
- data/app/models/naf/historical_job.rb +6 -3
- data/app/models/naf/queued_job.rb +3 -0
- data/app/models/naf/run_interval_style.rb +20 -0
- data/app/models/naf/running_job.rb +3 -0
- data/app/models/process/naf/data_migration/backfill_application_schedule_run_interval.rb +85 -0
- data/app/models/process/naf/log_archiver.rb +1 -1
- data/app/models/process/naf/log_reader.rb +141 -0
- data/app/models/process/naf/runner.rb +6 -49
- data/app/views/naf/application_schedule_affinity_tabs/_form.html.erb +1 -1
- data/app/views/naf/{applications → application_schedules}/_application_schedule_prerequisites.html.erb +1 -1
- data/app/views/naf/application_schedules/_form.html.erb +120 -0
- data/app/views/naf/application_schedules/edit.html.erb +11 -0
- data/app/views/naf/application_schedules/index.html.erb +47 -0
- data/app/views/naf/application_schedules/index.json.erb +8 -0
- data/app/views/naf/application_schedules/new.html.erb +11 -0
- data/app/views/naf/application_schedules/show.html.erb +130 -0
- data/app/views/naf/applications/_form.html.erb +44 -106
- data/app/views/naf/applications/_search_container.html.erb +29 -29
- data/app/views/naf/applications/index.html.erb +1 -10
- data/app/views/naf/applications/index.json.erb +22 -6
- data/app/views/naf/applications/show.html.erb +47 -97
- data/app/views/naf/logger_styles/_form.html.erb +0 -3
- data/app/views/naf/machines/_form.html.erb +3 -4
- data/config/routes.rb +3 -4
- data/db/migrate/20131219195439_add_run_interval_styles_table.rb +49 -0
- data/db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb +18 -0
- data/lib/naf/version.rb +1 -1
- data/naf.gemspec +1 -1
- data/spec/controllers/naf/application_schedule_affinity_tabs_controller_spec.rb +34 -27
- data/spec/controllers/naf/applications_controller_spec.rb +0 -48
- data/spec/factories/naf.rb +14 -8
- data/spec/models/logical/naf/application_spec.rb +9 -37
- data/spec/models/logical/naf/machine_spec.rb +1 -1
- data/spec/models/naf/application_schedule_spec.rb +38 -50
- data/spec/models/naf/application_spec.rb +3 -3
- data/spec/models/naf/historical_job_spec.rb +4 -2
- data/spec/models/naf/queued_job_spec.rb +2 -0
- data/spec/models/naf/run_interval_style_spec.rb +28 -0
- data/spec/models/naf/running_job_spec.rb +2 -0
- metadata +19 -7
- data/app/models/logical/naf/job_creator.rb +0 -151
- data/app/views/naf/applications/_application_schedule.html.erb +0 -80
- data/spec/models/logical/naf/job_creator_spec.rb +0 -102
@@ -0,0 +1,47 @@
|
|
1
|
+
<% content_for :body do %>
|
2
|
+
<div id='page-label'>
|
3
|
+
<h3 id="record_name">Application Schedules</h3>
|
4
|
+
</div>
|
5
|
+
<%= render partial: 'naf/shared/select_per_page' %>
|
6
|
+
</br></br>
|
7
|
+
|
8
|
+
<div id="flash_message">
|
9
|
+
<% unless notice.blank? %>
|
10
|
+
<script type='text/javascript'>
|
11
|
+
jQuery("<p id='notice'><%= notice %></p>")
|
12
|
+
.appendTo('#flash_message')
|
13
|
+
.slideDown().delay(5000).slideUp();
|
14
|
+
</script>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<table id='datatable'>
|
19
|
+
<thead>
|
20
|
+
<tr>
|
21
|
+
<th>Id</th>
|
22
|
+
<th>Application</th>
|
23
|
+
<th>Run Group Name</th>
|
24
|
+
<th>Run Group Restriction</th>
|
25
|
+
<th>Run Interval Style</th>
|
26
|
+
<th>Run Interval</th>
|
27
|
+
<th>Run Group Quantum</th>
|
28
|
+
<th>Run Group Limit</th>
|
29
|
+
<th>Enqueue</th>
|
30
|
+
<th>Affinities</th>
|
31
|
+
<th>Prerequisites</th>
|
32
|
+
</tr>
|
33
|
+
</thead>
|
34
|
+
<tbody>
|
35
|
+
<tr></tr>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<% content_for :javascripts do %>
|
40
|
+
<%= javascript_include_tag("dataTablesTemplates/application_schedules.js") %>
|
41
|
+
<script type='text/javascript'>
|
42
|
+
var sAjaxSource = "<%= naf.application_schedules_path(:json) %>";
|
43
|
+
</script>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<%= render partial: 'naf/shared/application' %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%
|
2
|
+
rows = @application_schedules.each do |schedule|
|
3
|
+
app = Naf::ApplicationSchedule.find(schedule.first)
|
4
|
+
schedule[0] = link_to schedule[0], naf.application_schedule_path(schedule[0])
|
5
|
+
schedule[1] = link_to schedule[1].title, naf.application_path(schedule[1])
|
6
|
+
end
|
7
|
+
%>
|
8
|
+
<%= raw rows %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :body do %>
|
2
|
+
<div id='record'>
|
3
|
+
<%= link_to 'Back', { controller: 'application_schedules', action: 'index' } %>
|
4
|
+
|
5
|
+
<h3 id='record_name'>Create a new Application Schedule</h3>
|
6
|
+
|
7
|
+
<%= render 'form' %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render partial: 'naf/shared/application' %>
|
@@ -0,0 +1,130 @@
|
|
1
|
+
<% content_for :body do %>
|
2
|
+
<div id="flash_message">
|
3
|
+
<% unless notice.blank? %>
|
4
|
+
<script type='text/javascript'>
|
5
|
+
jQuery("<p id='notice'><%= notice %></p>")
|
6
|
+
.appendTo('#flash_message')
|
7
|
+
.slideDown().delay(5000).slideUp();
|
8
|
+
</script>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div id="record">
|
13
|
+
<h2>Application</h2>
|
14
|
+
<%= link_to 'Back to Application Schedules', application_schedules_path %>
|
15
|
+
|
|
16
|
+
<%= link_to 'Edit', controller: 'application_schedules',
|
17
|
+
action: 'edit',
|
18
|
+
id: @application_schedule.id,
|
19
|
+
application_id: @application_schedule.application.id %>
|
20
|
+
|
|
21
|
+
<%= link_to "Add Affinity", new_application_schedule_application_schedule_affinity_tab_path(@application_schedule.id) %>
|
22
|
+
</br>
|
23
|
+
</br>
|
24
|
+
|
25
|
+
<table id="naf_table_show">
|
26
|
+
<thead>
|
27
|
+
<tr>
|
28
|
+
<th>Attribute</th>
|
29
|
+
<th>Value</th>
|
30
|
+
</tr>
|
31
|
+
</thead>
|
32
|
+
<tbody>
|
33
|
+
<tr>
|
34
|
+
<td>ID</td>
|
35
|
+
<td><%= @application_schedule.id %></td>
|
36
|
+
</tr>
|
37
|
+
<tr>
|
38
|
+
<td>Created At</td>
|
39
|
+
<td><%= @application_schedule.created_at %></td>
|
40
|
+
</tr>
|
41
|
+
<tr>
|
42
|
+
<td>Updated At</td>
|
43
|
+
<td><%= @application_schedule.updated_at %></td>
|
44
|
+
</tr>
|
45
|
+
<tr>
|
46
|
+
<td>Application</td>
|
47
|
+
<td style="white-space: pre-wrap;"><%= @application_schedule.application.title %></td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<td>Title</td>
|
51
|
+
<td><%= @application_schedule.title %></td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td>Application Run Group Name</td>
|
55
|
+
<td style="white-space: pre-wrap;"><%= @application_schedule.application_run_group_name %></td>
|
56
|
+
</tr>
|
57
|
+
<tr>
|
58
|
+
<td>Application Run Group Limit</td>
|
59
|
+
<td><%= @application_schedule.application_run_group_limit %></td>
|
60
|
+
</tr>
|
61
|
+
<tr>
|
62
|
+
<td>Application Run Group Quantum</td>
|
63
|
+
<td><%= @application_schedule.application_run_group_quantum %></td>
|
64
|
+
</tr>
|
65
|
+
<tr>
|
66
|
+
<td>Application Run Group Restriction Name</td>
|
67
|
+
<td><%= @application_schedule.application_run_group_restriction_name %></td>
|
68
|
+
</tr>
|
69
|
+
<tr>
|
70
|
+
<td>Run Interval</td>
|
71
|
+
<td><%= @application_schedule.run_interval %></td>
|
72
|
+
</tr>
|
73
|
+
<tr>
|
74
|
+
<td>Run Interval Style</td>
|
75
|
+
<td><%= @application_schedule.run_interval_style %></td>
|
76
|
+
</tr>
|
77
|
+
<tr>
|
78
|
+
<td>Priority</td>
|
79
|
+
<td><%= @application_schedule.priority %></td>
|
80
|
+
</tr>
|
81
|
+
<tr>
|
82
|
+
<td>Visible</td>
|
83
|
+
<td><%= @application_schedule.visible %></td>
|
84
|
+
</tr>
|
85
|
+
<tr>
|
86
|
+
<td>Enabled</td>
|
87
|
+
<td><%= @application_schedule.enabled %></td>
|
88
|
+
</tr>
|
89
|
+
<tr>
|
90
|
+
<td>Enqueue Backlogs</td>
|
91
|
+
<td><%= @application_schedule.enqueue_backlogs %></td>
|
92
|
+
</tr>
|
93
|
+
<tr>
|
94
|
+
<td><%= link_to "Application Schedule Affinity Tabs",
|
95
|
+
application_schedule_application_schedule_affinity_tabs_path(@application_schedule.id) %>
|
96
|
+
</td>
|
97
|
+
<td><%= @application_schedule.affinities %></td>
|
98
|
+
</tr>
|
99
|
+
</tbody>
|
100
|
+
</table>
|
101
|
+
</br>
|
102
|
+
|
103
|
+
<%= link_to "Destroy", @application_schedule.schedule,
|
104
|
+
{ confirm: "Are you sure you want to destroy this Application Schedule?",
|
105
|
+
method: :delete,
|
106
|
+
class: 'destroy' } %>
|
107
|
+
|
108
|
+
<h2>Prerequisites</h2>
|
109
|
+
<table id="naf_table_show">
|
110
|
+
<thead>
|
111
|
+
<tr>
|
112
|
+
<th width="10%">ID</th>
|
113
|
+
<th>Command</th>
|
114
|
+
</tr>
|
115
|
+
</thead>
|
116
|
+
<tbody>
|
117
|
+
<% @application_schedule.application_schedule_prerequisites.each do |prereq| -%>
|
118
|
+
<tr>
|
119
|
+
<td><%= link_to prereq.prerequisite_application_schedule.id, application_path(prereq.prerequisite_application_schedule.application) %></td>
|
120
|
+
<td style="white-space: pre-wrap;"><%= prereq.prerequisite_application_schedule.application.command %></td>
|
121
|
+
</tr>
|
122
|
+
<% end -%>
|
123
|
+
</tbody>
|
124
|
+
</table>
|
125
|
+
</br>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
<% end %>
|
129
|
+
|
130
|
+
<%= render partial: 'naf/shared/application' %>
|
@@ -1,109 +1,47 @@
|
|
1
1
|
<%= form_for @application do |f| %>
|
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
|
-
|
2
|
+
<% if @application.errors.any? %>
|
3
|
+
<div id="errorExplanation">
|
4
|
+
<h2><%= pluralize(@application.errors.count, "error") %> prohibited this application from being saved:</h2>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<div class="field">
|
9
|
+
<%= f.label :title, "Title*" %>
|
10
|
+
<%= f.text_field :title %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="field">
|
14
|
+
<%= f.label :short_name %>
|
15
|
+
<%= f.text_field :short_name %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :command, "Command*" %>
|
20
|
+
<%= f.text_area :command, rows: 4, cols: 60 %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="field">
|
24
|
+
<%= f.label :application_type_id, "Application type*" %>
|
25
|
+
<%= f.select(:application_type_id,
|
26
|
+
::Naf::ApplicationType.all.map { |a| [a.script_type_name, a.id] },
|
27
|
+
{ include_blank: true }) %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label :log_level %>
|
32
|
+
<%= f.text_field :log_level %>
|
33
|
+
</div>
|
34
|
+
<br/>
|
35
|
+
|
36
|
+
<div class="field">
|
37
|
+
<%= f.label :deleted %>
|
38
|
+
<%= f.check_box :deleted %>
|
39
|
+
<br/><br/>
|
40
|
+
</div>
|
41
|
+
<br/>
|
42
|
+
|
43
|
+
<div class="actions">
|
35
44
|
<br/>
|
36
|
-
|
37
|
-
|
38
|
-
<%= f.label :deleted %>
|
39
|
-
<%= f.check_box :deleted %>
|
40
|
-
<br/><br/>
|
41
|
-
</div>
|
42
|
-
<br/>
|
43
|
-
|
44
|
-
<div id="application_schedule">
|
45
|
-
<%= f.fields_for :application_schedule do |builder| %>
|
46
|
-
<%= render "application_schedule", :f => builder %>
|
47
|
-
<% end %>
|
48
|
-
</div>
|
49
|
-
<%= link_to "Add Application Schedule", "#" , :id => "add_application_schedule"%>
|
50
|
-
|
51
|
-
<div class="actions">
|
52
|
-
<br/>
|
53
|
-
<%= f.submit %>
|
54
|
-
</div>
|
55
|
-
<% end %>
|
56
|
-
|
57
|
-
<% content_for :javascripts do %>
|
58
|
-
<script type='text/javascript'>
|
59
|
-
jQuery(document).ready(function() {
|
60
|
-
|
61
|
-
<% if @show_app_schedule %>
|
62
|
-
addSchedule();
|
63
|
-
<% else %>
|
64
|
-
removeSchedule();
|
65
|
-
<% end %>
|
66
|
-
|
67
|
-
var run_group = jQuery("#application_application_schedule_attributes_application_run_group_name");
|
68
|
-
|
69
|
-
if(jQuery("#run_group_name_type").val() != 'custom') {
|
70
|
-
run_group.hide();
|
71
|
-
run_group.val(null);
|
72
|
-
}
|
73
|
-
|
74
|
-
jQuery("#run_group_name_type").change(function () {
|
75
|
-
var type = jQuery("#run_group_name_type").val();
|
76
|
-
if(type == 'command') {
|
77
|
-
run_group.hide();
|
78
|
-
run_group.val(null);
|
79
|
-
} else if(type == 'not set') {
|
80
|
-
run_group.hide();
|
81
|
-
run_group.val(null);
|
82
|
-
} else {
|
83
|
-
run_group.slideToggle("slow");
|
84
|
-
}
|
85
|
-
});
|
86
|
-
|
87
|
-
jQuery("#add_application_schedule").click(function() {
|
88
|
-
addSchedule();
|
89
|
-
});
|
90
|
-
|
91
|
-
jQuery("#remove_application_schedule").click(function() {
|
92
|
-
removeSchedule();
|
93
|
-
});
|
94
|
-
|
95
|
-
});
|
96
|
-
|
97
|
-
function addSchedule(){
|
98
|
-
jQuery("#application_schedule").css("display", "block");
|
99
|
-
jQuery("#application_application_schedule_attributes__destroy").val("0");
|
100
|
-
jQuery("#add_application_schedule").hide();
|
101
|
-
}
|
102
|
-
|
103
|
-
function removeSchedule(){
|
104
|
-
jQuery("#application_schedule").hide();
|
105
|
-
jQuery("#application_application_schedule_attributes__destroy").val("1");
|
106
|
-
jQuery("#add_application_schedule").css("display", "block");
|
107
|
-
}
|
108
|
-
</script>
|
45
|
+
<%= f.submit %>
|
46
|
+
</div>
|
109
47
|
<% end %>
|
@@ -19,40 +19,40 @@
|
|
19
19
|
</div>
|
20
20
|
<div id="search_container">
|
21
21
|
<%= form_tag(naf.applications_path, method: "get", id: 'application_search', class: 'search_select_input') do %>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
<div style="width:30%;" class="display-inline-block">
|
23
|
+
<div class="field">
|
24
|
+
<%= label(:title, "Title:") %>
|
25
|
+
<%= text_field(:search, :title, { class: 'datatable_variable' }) %>
|
26
|
+
</div>
|
27
|
+
<br/>
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
<div class="field">
|
30
|
+
<%= label(:application_run_group_name, "Run Group:") %>
|
31
|
+
<%= text_field(:search, :application_run_group_name, { class: 'datatable_variable' }) %>
|
32
|
+
</div>
|
33
|
+
<br/>
|
34
|
+
</div>
|
35
|
+
<div style="width:30%; padding-left:40px;" class="display-inline-block">
|
36
|
+
<div class="field">
|
37
|
+
<%= label(:command, "Command:") %>
|
38
|
+
<%= text_field(:search, :command, { class: 'datatable_variable' }) %>
|
34
39
|
</div>
|
35
|
-
<
|
36
|
-
<div class="field">
|
37
|
-
<%= label(:command, "Command:") %>
|
38
|
-
<%= text_field(:search, :command, { class: 'datatable_variable' }) %>
|
39
|
-
</div>
|
40
|
-
<br/>
|
40
|
+
<br/>
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
</div>
|
46
|
-
<br/>
|
42
|
+
<div class="field">
|
43
|
+
<%= label(:short_name, "Short name:") %>
|
44
|
+
<%= text_field(:search, :short_name, { class: 'datatable_variable' }) %>
|
47
45
|
</div>
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
<br/>
|
47
|
+
</div>
|
48
|
+
<div style="width:30%; padding-left:40px;" class="display-inline-block">
|
49
|
+
<div class="field">
|
50
|
+
<%= label(:enabled, "App schedules enabled:") %>
|
51
|
+
<%= select(:search, :enabled, [["Ignore", nil], ["True", true], ["False", false]], {}, { class: 'datatable_variable' }) %>
|
53
52
|
</div>
|
54
|
-
|
55
|
-
|
53
|
+
</div>
|
54
|
+
<br/><br/><br/>
|
55
|
+
<%= submit_tag("Search") %>
|
56
56
|
<% end %>
|
57
57
|
</div>
|
58
58
|
|
@@ -20,18 +20,9 @@
|
|
20
20
|
<th>Title</th>
|
21
21
|
<th>Short Name</th>
|
22
22
|
<th>Type</th>
|
23
|
-
<th>
|
24
|
-
<th>Restriction</th>
|
25
|
-
<th>Run Group Limit</th>
|
26
|
-
<th>Enabled</th>
|
27
|
-
<th>Enqueue</th>
|
28
|
-
<th>Run Time</th>
|
23
|
+
<th>Application Schedules</th>
|
29
24
|
<th>Last Queued At</th>
|
30
|
-
<th>Affinities</th>
|
31
|
-
<th>Prerequisites</th>
|
32
25
|
<th>Actions</th>
|
33
|
-
<th></th>
|
34
|
-
<th></th>
|
35
26
|
</tr>
|
36
27
|
</thead>
|
37
28
|
<tbody>
|