naf 1.1.4 → 2.0.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.
Files changed (118) hide show
  1. data/Gemfile +4 -2
  2. data/app/assets/images/{papertrail_job.png → job.png} +0 -0
  3. data/app/assets/images/{papertrail_machine.png → machine.png} +0 -0
  4. data/app/assets/images/{papertrail_machine_runner.png → machine_runner.png} +0 -0
  5. data/app/assets/javascripts/col_reorder_with_resize.js +1228 -0
  6. data/app/assets/javascripts/dataTablesTemplates/applications.js +2 -1
  7. data/app/assets/javascripts/dataTablesTemplates/jobs.js +2 -1
  8. data/app/assets/javascripts/dataTablesTemplates/machine_runner_invocations.js +2 -1
  9. data/app/assets/javascripts/dataTablesTemplates/machine_runners.js +2 -1
  10. data/app/assets/javascripts/dataTablesTemplates/machines.js +2 -1
  11. data/app/assets/javascripts/jquery.dataTables.js +10339 -5103
  12. data/app/assets/javascripts/naf.js +1 -0
  13. data/app/assets/stylesheets/jquery_ui/jquery-ui-1.8.5.custom.css.erb +6 -6
  14. data/app/assets/stylesheets/min_naf/layout.css.scss +94 -43
  15. data/app/assets/stylesheets/naf/layout.css.scss +94 -43
  16. data/app/controllers/naf/affinities_controller.rb +1 -1
  17. data/app/controllers/naf/applications_controller.rb +3 -0
  18. data/app/controllers/naf/historical_job_affinity_tabs_controller.rb +1 -1
  19. data/app/controllers/naf/historical_jobs_controller.rb +2 -5
  20. data/app/controllers/naf/log_parsers_controller.rb +16 -0
  21. data/app/controllers/naf/log_viewer_controller.rb +19 -0
  22. data/app/controllers/naf/machine_affinity_slots_controller.rb +1 -1
  23. data/app/controllers/naf/machine_runners_controller.rb +12 -0
  24. data/app/controllers/naf/machines_controller.rb +8 -10
  25. data/app/controllers/naf/status_controller.rb +12 -0
  26. data/app/helpers/naf/application_helper.rb +19 -38
  27. data/app/helpers/naf/time_helper.rb +37 -0
  28. data/app/models/logical/naf/application.rb +13 -19
  29. data/app/models/logical/naf/construction_zone/boss.rb +1 -1
  30. data/app/models/logical/naf/construction_zone/foreman.rb +1 -1
  31. data/app/models/logical/naf/job.rb +39 -34
  32. data/app/models/logical/naf/job_creator.rb +19 -23
  33. data/app/models/logical/naf/job_fetcher.rb +36 -6
  34. data/app/models/logical/naf/log_file.rb +70 -0
  35. data/app/models/logical/naf/log_parser/base.rb +272 -0
  36. data/app/models/logical/naf/log_parser/job.rb +65 -0
  37. data/app/models/logical/naf/log_parser/machine.rb +64 -0
  38. data/app/models/logical/naf/log_parser/runner.rb +72 -0
  39. data/app/models/logical/naf/log_reader.rb +85 -0
  40. data/app/models/logical/naf/machine.rb +39 -1
  41. data/app/models/naf/affinity.rb +18 -0
  42. data/app/models/naf/application_schedule_affinity_tab.rb +1 -0
  43. data/app/models/naf/application_type.rb +2 -1
  44. data/app/models/naf/historical_job.rb +9 -29
  45. data/app/models/naf/machine.rb +8 -0
  46. data/app/models/naf/machine_runner.rb +11 -2
  47. data/app/models/naf/machine_runner_invocation.rb +9 -1
  48. data/app/models/naf/running_job.rb +40 -1
  49. data/app/models/process/naf/application.rb +3 -3
  50. data/app/models/process/naf/log_archiver.rb +78 -0
  51. data/app/models/process/naf/machine_manager.rb +3 -1
  52. data/app/models/process/naf/runner.rb +286 -162
  53. data/app/models/process/naf/runner_log.rb +26 -0
  54. data/app/views/naf/application_schedule_affinity_tabs/_form.html.erb +1 -5
  55. data/app/views/naf/applications/show.html.erb +1 -1
  56. data/app/views/naf/historical_job_affinity_tabs/_form.html.erb +1 -5
  57. data/app/views/naf/historical_jobs/_form.html.erb +1 -1
  58. data/app/views/naf/historical_jobs/_runners.html.erb +21 -12
  59. data/app/views/naf/historical_jobs/_search_container.html.erb +1 -2
  60. data/app/views/naf/historical_jobs/index.html.erb +0 -1
  61. data/app/views/naf/historical_jobs/index.json.erb +4 -4
  62. data/app/views/naf/historical_jobs/show.html.erb +57 -51
  63. data/app/views/naf/log_viewer/_job_logs.html.erb +65 -0
  64. data/app/views/naf/log_viewer/_log_display.html.erb +259 -0
  65. data/app/views/naf/log_viewer/_log_layout.html.erb +59 -0
  66. data/app/views/naf/log_viewer/_machine_logs.html.erb +62 -0
  67. data/app/views/naf/log_viewer/_runner_logs.html.erb +62 -0
  68. data/app/views/naf/log_viewer/_search_options.html.erb +36 -0
  69. data/app/views/naf/log_viewer/_update_page_title.html.erb +9 -0
  70. data/app/views/naf/log_viewer/index.html.erb +1 -0
  71. data/app/views/naf/logger_names/_form.html.erb +1 -2
  72. data/app/views/naf/machine_affinity_slots/_form.html.erb +1 -5
  73. data/app/views/naf/machine_runner_invocations/show.html.erb +4 -0
  74. data/app/views/naf/machine_runners/show.html.erb +44 -34
  75. data/app/views/naf/machines/index.json.erb +14 -6
  76. data/app/views/naf/machines/show.html.erb +44 -40
  77. data/app/views/naf/shared/_auto_resize_width.html.erb +7 -0
  78. data/app/views/naf/shared/_date_select.html.erb +65 -0
  79. data/app/views/naf/shared/_select_per_page.html.erb +48 -13
  80. data/app/views/naf/status/index.html.erb +27 -0
  81. data/bin/naf +26 -0
  82. data/config/initializers/naf.rb +13 -1
  83. data/config/routes.rb +16 -2
  84. data/db/migrate/20131106162436_add_uuid_column_to_machine_runner_invocations.rb +15 -0
  85. data/db/migrate/20131121185222_move_tabs_column_from_historical_jobs_to_running_jobs.rb +15 -0
  86. data/lib/generators/templates/config/logging/naf.yml +0 -8
  87. data/lib/generators/templates/config/logging/nafjob.yml +0 -8
  88. data/lib/generators/templates/config/logging/nafrunner.yml +0 -8
  89. data/lib/generators/templates/naf.rb +0 -8
  90. data/lib/naf.rb +0 -8
  91. data/lib/naf/configuration.rb +0 -4
  92. data/lib/naf/version.rb +1 -1
  93. data/lib/tasks/naf_tasks.rake +18 -0
  94. data/naf.gemspec +3 -1
  95. data/spec/controllers/naf/affinities_controller_spec.rb +0 -1
  96. data/spec/controllers/naf/applications_controller_spec.rb +3 -2
  97. data/spec/controllers/naf/machine_affinity_slots_controller_spec.rb +0 -1
  98. data/spec/controllers/naf/machines_controller_spec.rb +1 -1
  99. data/spec/dummy/config/logging/naf.yml +0 -8
  100. data/spec/dummy/config/logging/nafjob.yml +0 -9
  101. data/spec/dummy/config/logging/nafrunner.yml +0 -10
  102. data/spec/factories/naf.rb +4 -0
  103. data/spec/models/logical/naf/application_spec.rb +3 -4
  104. data/spec/models/logical/naf/job_creator_spec.rb +91 -21
  105. data/spec/models/logical/naf/job_spec.rb +19 -6
  106. data/spec/models/logical/naf/log_file_spec.rb +105 -0
  107. data/spec/models/logical/naf/machine_runner_invocation_spec.rb +41 -0
  108. data/spec/models/logical/naf/machine_runner_spec.rb +42 -0
  109. data/spec/models/logical/naf/machine_spec.rb +98 -28
  110. data/spec/models/naf/affinity_classification_spec.rb +20 -0
  111. data/spec/models/naf/affinity_spec.rb +21 -0
  112. data/spec/models/naf/historical_job_spec.rb +2 -44
  113. data/spec/models/naf/machine_runner_invocation_spec.rb +17 -1
  114. data/spec/models/naf/running_job_spec.rb +64 -1
  115. metadata +40 -9
  116. data/app/models/log4r/papertrail_outputter.rb +0 -19
  117. data/app/views/naf/historical_jobs/edit.html.erb +0 -11
  118. data/app/views/naf/machines/_show.html.erb +0 -169
@@ -0,0 +1,7 @@
1
+ <% content_for :javascripts do %>
2
+ <script type='text/javascript'>
3
+ window.onresize = function() {
4
+ jQuery('<%= div_class %>').width(jQuery(window).width() - 50);
5
+ }
6
+ </script>
7
+ <% end %>
@@ -0,0 +1,65 @@
1
+ <%= select_tag(
2
+ (prefix + '_year').to_sym,
3
+ options_for_select([['year', ''], ["2013", 2013], ["2014", 2014]
4
+ ]),
5
+ { style: dropdown_width })
6
+ %>
7
+ <%= select_tag(
8
+ (prefix + '_month').to_sym,
9
+ options_for_select([
10
+ ['month', ''], ["January", 1], ["February", 2], ["March", 3], ["April", 4],
11
+ ["May", 5], ["June", 6], ["July", 7], ["August", 8], ["September", 9],
12
+ ["October", 10], ["November", 11], ["December", 12]
13
+ ]),
14
+ { style: dropdown_width })
15
+ %>
16
+ <%= select_tag(
17
+ (prefix + '_day').to_sym,
18
+ options_for_select([
19
+ ['day', ''], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8],
20
+ [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16],
21
+ [17, 17], [18, 18], [19, 19], [20, 20], [21, 21], [22, 22], [23, 23], [24, 24],
22
+ [25, 25], [26, 26], [27, 27], [28, 28], [29, 29], [30, 30], [31, 31]
23
+ ]),
24
+ { style: dropdown_width })
25
+ %>
26
+ <%= select_tag(
27
+ (prefix + '_hour').to_sym,
28
+ options_for_select([
29
+ ['hour', ''], ["1am", 1], ["2am", 2], ["3am", 3], ["4am",4 ], ["5am", 5], ["6am", 6],
30
+ ["7am", 7], ["8am", 8], ["9am", 9], ["10am", 10], ["11am", 11], ["12pm", 12],
31
+ ["1pm", 13], ["2pm", 14], ["3pm", 15], ["4pm", 16], ["5pm", 17], ["6pm", 18],
32
+ ["7pm", 19], ["8pm", 20], ["9pm", 21], ["10pm", 22], ["11pm", 23], ["12am", 24]
33
+ ]),
34
+ { style: dropdown_width })
35
+ %>
36
+ <%= select_tag(
37
+ (prefix + '_minute').to_sym,
38
+ options_for_select([
39
+ ['minute', ''], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8],
40
+ [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15], [16, 16],
41
+ [17, 17], [18, 18], [19, 19], [20, 20], [21, 21], [22, 22], [23, 23], [24, 24],
42
+ [25, 25], [26, 26], [27, 27], [28, 28], [29, 29], [30, 30], [31, 31], [32, 32],
43
+ [33, 33], [34, 34], [35, 35], [36, 36], [37, 37], [38, 38], [39, 39], [40, 40],
44
+ [41, 41], [42, 42], [43, 43], [44, 44], [45, 45], [46, 46], [47, 47], [48, 48],
45
+ [49, 49], [50, 50], [51, 51], [52, 52], [53, 53], [54, 54], [55, 55], [56, 56],
46
+ [57, 57], [58, 58], [59, 59], [60, 60]
47
+ ]),
48
+ { style: dropdown_width })
49
+ %>
50
+ &nbsp;&nbsp;&nbsp;
51
+ <%= button_tag 'clear', id: "#{prefix}_class_button" %>
52
+
53
+ <% content_for :javascripts do %>
54
+ <script type='text/javascript'>
55
+ jQuery(document).ready(function () {
56
+ jQuery("#<%= prefix %>_class_button").click(function () {
57
+ jQuery('#<%= prefix %>_year').val('');
58
+ jQuery('#<%= prefix %>_month').val('');
59
+ jQuery('#<%= prefix %>_day').val('');
60
+ jQuery('#<%= prefix %>_hour').val('');
61
+ jQuery('#<%= prefix %>_minute').val('');
62
+ });
63
+ });
64
+ </script>
65
+ <% end %>
@@ -2,11 +2,8 @@
2
2
  <script type='text/javascript'>
3
3
 
4
4
  function initPageSelect() {
5
- var pageSelect = jQuery('#page-select-container');
6
- var refreshPage = jQuery('#refresh-page-container');
7
- jQuery('#datatable_paginate').append(pageSelect).append(refreshPage);
8
- pageSelect.show();
9
- refreshPage.show();
5
+ jQuery('#page-select-container').show();
6
+ jQuery('#refresh-page-container').show();
10
7
  }
11
8
 
12
9
  function getDisplayLength() {
@@ -19,6 +16,7 @@
19
16
  // Redraw datatable.
20
17
  var redrawDatatable = function() {
21
18
  jQuery("#datatable").dataTable().fnDraw(false);
19
+ checkRunnersAndSchedules();
22
20
  if ( jQuery('#auto_refresh').is(':checked') ) {
23
21
  timeout_id = setTimeout(redrawDatatable, 10000);
24
22
  }
@@ -39,6 +37,7 @@
39
37
 
40
38
  jQuery('#refresh_datatable').click(function(){
41
39
  jQuery('#datatable').dataTable().fnDraw();
40
+ checkRunnersAndSchedules();
42
41
  });
43
42
 
44
43
  // Set change event to enabled/disable auto-refresh
@@ -52,21 +51,57 @@
52
51
  });
53
52
  });
54
53
 
54
+ function checkRunnersAndSchedules() {
55
+ <% if controller_name == 'historical_jobs' %>
56
+ updateRunnerCount();
57
+ updateLastCheckedScheduleAt();
58
+ <% end %>
59
+ }
60
+
61
+ function updateRunnerCount() {
62
+ jQuery.ajax({
63
+ url: '/job_system/machine_runners/runner_count',
64
+ type: 'GET',
65
+ dataType: 'json',
66
+ success:function (data) {
67
+ jQuery('.running-count').text(data['running'] + ' running');
68
+ jQuery('.winding-down-count').text(data['winding_down'] + ' winding down');
69
+ jQuery('.down-count').text(data['down'] + ' down');
70
+ }
71
+ });
72
+ }
73
+
74
+ function updateLastCheckedScheduleAt() {
75
+ jQuery.ajax({
76
+ url: '/job_system/machines/last_checked_schedule_at',
77
+ type: 'GET',
78
+ dataType: 'json',
79
+ success:function (data) {
80
+ if(data['last_checked_schedule_at'] == null){
81
+ jQuery('.last_checked_schedule_at').text('');
82
+ }
83
+ else{
84
+ jQuery('.last_checked_schedule_at').text(data['last_checked_schedule_at']);
85
+ }
86
+ }
87
+ });
88
+ }
89
+
55
90
  </script>
56
91
  <% end %>
57
92
 
58
- <div id='refresh-page-container'>
59
- <%= link_to "Refresh Table", "#", id: :refresh_datatable %>
60
- &nbsp;&nbsp;
61
- <%= label_tag :auto_refresh, 'Auto Refresh:' %>
62
- <%= check_box_tag :auto_refresh, 1, false, id: :auto_refresh %>
63
- </div>
64
-
65
93
  <div id="page-select-container" class="ui-state-default ui-corner-all">
66
94
  <%= form_tag({ controller: params[:controller], action: params[:action], format: 'js' }, method: :get) do %>
67
95
  <%= label_tag :iDisplayLength, "Rows Per Page:", class: "label" %>
68
96
  <%= select_tag :iDisplayLength,
69
- options_for_select(::Naf.configuration.default_page_options, @rows_per_page),
97
+ options_for_select(::Naf.configuration.default_page_options, @rows_per_page),
70
98
  class: "page-select datatable_variable ui-state-default ui-corner-all" %>
71
99
  <% end %>
72
100
  </div>
101
+
102
+ <div id='refresh-page-container'>
103
+ <%= link_to "Refresh Table", "#", id: :refresh_datatable %>
104
+ &nbsp;&nbsp;
105
+ <%= label_tag :auto_refresh, 'Auto Refresh:' %>
106
+ <%= check_box_tag :auto_refresh, 1, false, id: :auto_refresh %>
107
+ </div>
@@ -0,0 +1,27 @@
1
+ <% content_for :body do %>
2
+ <div id="record">
3
+ <h2>Status</h2>
4
+
5
+ <table id="naf_table_show">
6
+ <thead>
7
+ <tr>
8
+ <th>Server</th>
9
+ <th>Status</th>
10
+ <th>Notes</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% @machines.each do |machine| -%>
15
+ <tr>
16
+ <td><%= machine[:server_name] %></td>
17
+ <td><%= machine[:status] %></td>
18
+ <td><%= machine[:notes] %></td>
19
+ </tr>
20
+ <% end %>
21
+ </tbody>
22
+ </table>
23
+ </br>
24
+
25
+ </div>
26
+ <% end %>
27
+ <%= render partial: 'naf/shared/application' %>
data/bin/naf ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "bundle exec naf" from the root of your application.
3
+
4
+ action, option = ARGV
5
+ if action == 'runner'
6
+ if option == 'up'
7
+ puts "Bringing up the runner(s)..."
8
+ `screen -d -m bash -c 'source /root/.bash_profile && cd /root/current && a=\`uuidgen\` && script/rails runner ::Process::Naf::Runner.run --invocation-uuid $a 2>&1 |
9
+ script/rails runner ::Process::Naf::RunnerLog.run --invocation-uuid $a'`
10
+
11
+ elsif option == 'status'
12
+ num_runners = Integer(`ps -ef | grep Process::Naf::Runner.run | grep -v grep | grep -v uuidgen | wc -l`.strip)
13
+ hostname = `hostname`.strip
14
+ if num_runners == 0
15
+ puts "down: #{hostname}"
16
+ elsif num_runners == 1
17
+ puts "up: #{hostname}"
18
+ else
19
+ puts "up/w: #{hostname} (#{num_runners})"
20
+ end
21
+
22
+ elsif option == 'down'
23
+ puts 'Bringing down runner(s)...'
24
+ `kill $(ps -ef | grep Process::Naf::Runner.run | grep -v grep | grep -v uuidgen | awk '{ print $2 }') | cat`
25
+ end
26
+ end
@@ -1,3 +1,15 @@
1
1
  module Naf
2
- DEFAULT_PAGE_OPTIONS = [10, 20, 50, 100, 250, 500, 750, 1000, 1500, 2000]
2
+ DEFAULT_PAGE_OPTIONS = [10, 20, 50, 100, 250, 500, 750, 1000, 1500, 2000]
3
+ LOGGING_ARCHIVE_DIRECTORY = "/archive"
4
+ if ['test', 'development'].include?(Rails.env)
5
+ LOGGING_ROOT_DIRECTORY = 'var/log'
6
+ else
7
+ LOGGING_ROOT_DIRECTORY = '/var/log'
8
+ end
9
+
10
+ NAF_DATABASE_HOSTNAME = Rails.configuration.database_configuration[Rails.env]['host'].present? ?
11
+ Rails.configuration.database_configuration[Rails.env]['host'] : 'localhost'
12
+ NAF_DATABASE = Rails.configuration.database_configuration[Rails.env]['database']
13
+ PREFIX_PATH = "#{LOGGING_ROOT_DIRECTORY}/naf/#{NAF_DATABASE_HOSTNAME}/#{NAF_DATABASE}"
14
+
3
15
  end
@@ -1,5 +1,5 @@
1
1
  Naf::Engine.routes.draw do
2
- resources :historical_jobs do
2
+ resources :historical_jobs, except: [:edit] do
3
3
  resources :historical_job_affinity_tabs, except: [:destroy]
4
4
  end
5
5
 
@@ -11,9 +11,16 @@ Naf::Engine.routes.draw do
11
11
 
12
12
  resources :machines, except: [:destroy] do
13
13
  resources :machine_affinity_slots
14
+ collection do
15
+ get :last_checked_schedule_at
16
+ end
14
17
  end
15
18
 
16
- resources :machine_runners, only: [:index, :show]
19
+ resources :machine_runners, only: [:index, :show] do
20
+ collection do
21
+ get :runner_count
22
+ end
23
+ end
17
24
  resources :machine_runner_invocations, only: [:index, :show, :update] do
18
25
  collection do
19
26
  get :wind_down_all
@@ -22,6 +29,13 @@ Naf::Engine.routes.draw do
22
29
  resources :logger_styles
23
30
  resources :logger_names
24
31
  resources :affinities
32
+ resources :log_parsers, only: [] do
33
+ collection do
34
+ get :logs
35
+ end
36
+ end
37
+ resources :status, only: [:index]
38
+ resources :log_viewer, only: [:index]
25
39
 
26
40
  resources :janitorial_archive_assignments, controller: "janitorial_assignments",
27
41
  type: "Naf::JanitorialArchiveAssignment",
@@ -0,0 +1,15 @@
1
+ class AddUuidColumnToMachineRunnerInvocations < ActiveRecord::Migration
2
+
3
+ def up
4
+ execute <<-SQL
5
+ ALTER TABLE #{Naf.schema_name}.machine_runner_invocations ADD COLUMN uuid text unique;
6
+ SQL
7
+ end
8
+
9
+ def down
10
+ execute <<-SQL
11
+ ALTER TABLE #{Naf.schema_name}.machine_runner_invocations DROP COLUMN uuid;
12
+ SQL
13
+ end
14
+
15
+ end
@@ -0,0 +1,15 @@
1
+ class MoveTabsColumnFromHistoricalJobsToRunningJobs < ActiveRecord::Migration
2
+ def up
3
+ execute <<-SQL
4
+ ALTER TABLE #{Naf.schema_name}.historical_jobs DROP COLUMN tags;
5
+ ALTER TABLE #{Naf.schema_name}.running_jobs ADD COLUMN tags text[];
6
+ SQL
7
+ end
8
+
9
+ def down
10
+ execute <<-SQL
11
+ ALTER TABLE #{Naf.schema_name}.historical_jobs ADD COLUMN tags text[];
12
+ ALTER TABLE #{Naf.schema_name}.running_jobs DROP COLUMN tags;
13
+ SQL
14
+ end
15
+ end
@@ -12,11 +12,3 @@ log4r_config:
12
12
  date_pattern: '%y%m%d %H:%M:%S.%L'
13
13
  pattern : '%d pid=%p jid=%g %C %l %M'
14
14
  type : PatternFormatter
15
-
16
- - type: PapertrailOutputter
17
- name: papertrail
18
- port: 0 # XXX put your papertrail port here
19
- program: naf_application
20
- formatter:
21
- pattern : 'pid=%p %C %l %M'
22
- type : PatternFormatter
@@ -6,11 +6,3 @@ log4r_config:
6
6
  date_pattern: '%y%m%d %H:%M:%S.%L'
7
7
  pattern : '%d pid=%p jid=%g %C %l %M'
8
8
  type : PatternFormatter
9
-
10
- - type: PapertrailOutputter
11
- name: papertrail
12
- port: 0 # XXX put your papertrail port here
13
- program: jid(%g)
14
- formatter:
15
- pattern : '%C %l %M'
16
- type : PatternFormatter
@@ -7,11 +7,3 @@ log4r_config:
7
7
  date_pattern: '%y%m%d %H:%M:%S.%L'
8
8
  pattern : '%d runner_pid=%p %C %l %M'
9
9
  type : PatternFormatter
10
-
11
- - type: PapertrailOutputter
12
- name: papertrail
13
- port: 0 # XXX put your papertrail port here
14
- program: runner
15
- formatter:
16
- pattern : '%C %l %M'
17
- type : PatternFormatter
@@ -1,11 +1,3 @@
1
1
  Naf.configure do |config|
2
-
3
2
  config.schema_name = '<%= schema_name %>'
4
-
5
- # Setting up papertrail links
6
- # config.papertrail_group_id =
7
-
8
- # Please get it from your profile on Papertrail
9
- # config.papertrail_token =
10
-
11
3
  end
data/lib/naf.rb CHANGED
@@ -29,14 +29,6 @@ module Naf
29
29
  configuration.title
30
30
  end
31
31
 
32
- def papertrail_group_id
33
- configuration.papertrail_group_id
34
- end
35
-
36
- def papertrail_token
37
- configuration.papertrail_token
38
- end
39
-
40
32
  def layout
41
33
  configuration.layout
42
34
  end
@@ -4,8 +4,6 @@ module Naf
4
4
  :model_class,
5
5
  :controller_class,
6
6
  :title,
7
- :papertrail_group_id,
8
- :papertrail_token,
9
7
  :layout,
10
8
  :default_page_options
11
9
 
@@ -13,8 +11,6 @@ module Naf
13
11
  @model_class = "::ActiveRecord::Base"
14
12
  @controller_class = "::ApplicationController"
15
13
  @title = "Naf - a Rails Job Scheduling Engine"
16
- @papertrail_group_id = nil
17
- @papertrail_token = nil
18
14
  @layout = "naf_layout"
19
15
  @default_page_options = [10, 20, 50, 100, 250, 500, 750, 1000, 1500, 2000]
20
16
  end
@@ -1,3 +1,3 @@
1
1
  module Naf
2
- VERSION = "1.1.4"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -63,6 +63,24 @@ namespace :naf do
63
63
  end
64
64
  end
65
65
 
66
+ namespace :logs do
67
+ desc "Archive logs (moves logs to a different directory)"
68
+ task archive: :environment do
69
+ # When installing Naf, check the filesystem for existence of naflogs.
70
+ # If so, archive the logs before you start using the system.
71
+ if File.directory?(Naf::LOGGING_ROOT_DIRECTORY + "/naf")
72
+ # Each archive will have a unique path based on the time archived
73
+ time = Time.zone.now.to_s
74
+ FileUtils.mkdir_p(Naf::LOGGING_ROOT_DIRECTORY + Naf::LOGGING_ARCHIVE_DIRECTORY + "/#{time}")
75
+
76
+ puts "Moving naf logs into archive directory: #{Naf::LOGGING_ROOT_DIRECTORY + Naf::LOGGING_ARCHIVE_DIRECTORY}/#{time.gsub(' ', '\ ')}"
77
+ # Move the naf logs into the archive directory
78
+ system "mv #{Naf::LOGGING_ROOT_DIRECTORY}/naf " +
79
+ "#{Naf::LOGGING_ROOT_DIRECTORY + Naf::LOGGING_ARCHIVE_DIRECTORY}/#{time.gsub(' ', '\ ')}"
80
+ end
81
+ end
82
+ end
83
+
66
84
  namespace :db do
67
85
  desc "Custom migrate task, connects to correct database, migrations found in db/naf/migrate"
68
86
  task migrate: :environment do
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.name = "naf"
9
9
  s.version = Naf::VERSION
10
10
  s.license = 'New BSD License'
11
- s.date = '2013-12-18'
11
+ s.date = '2013-12-19'
12
12
  s.summary = "Creates infrastructure for a customizable and robust Postgres-backed script scheduling/running"
13
13
  s.description = "A cloud based distributed cron, application framework and operations console. Naf works as a distributed script running " +
14
14
  "system that provides scheduling, logging, alarming, machine redundancy, and the ability to set constraint during script execution"
@@ -28,4 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency "rspec-rails"
29
29
  s.add_development_dependency "factory_girl_rails", "~> 4.0.0"
30
30
  s.add_development_dependency 'awesome_print'
31
+
32
+ s.executables = ["naf"]
31
33
  end