naf 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/README.rdoc +28 -4
  2. data/RELEASE_NOTES.rdoc +8 -0
  3. data/app/assets/javascripts/dataTablesTemplates/application_schedules.js +72 -0
  4. data/app/assets/javascripts/dataTablesTemplates/applications.js +12 -21
  5. data/app/controllers/naf/application_schedule_affinity_tabs_controller.rb +5 -8
  6. data/app/controllers/naf/application_schedules_controller.rb +98 -0
  7. data/app/controllers/naf/applications_controller.rb +6 -98
  8. data/app/controllers/naf/historical_jobs_controller.rb +18 -8
  9. data/app/helpers/naf/application_helper.rb +47 -22
  10. data/app/models/logical/naf/application.rb +9 -126
  11. data/app/models/logical/naf/application_schedule.rb +186 -0
  12. data/app/models/logical/naf/construction_zone/boss.rb +4 -5
  13. data/app/models/logical/naf/construction_zone/foreman.rb +34 -13
  14. data/app/models/logical/naf/construction_zone/proletariat.rb +1 -0
  15. data/app/models/logical/naf/construction_zone/work_order.rb +11 -4
  16. data/app/models/logical/naf/job_fetcher.rb +1 -0
  17. data/app/models/naf/application.rb +5 -16
  18. data/app/models/naf/application_schedule.rb +117 -43
  19. data/app/models/naf/historical_job.rb +6 -3
  20. data/app/models/naf/queued_job.rb +3 -0
  21. data/app/models/naf/run_interval_style.rb +20 -0
  22. data/app/models/naf/running_job.rb +3 -0
  23. data/app/models/process/naf/data_migration/backfill_application_schedule_run_interval.rb +85 -0
  24. data/app/models/process/naf/log_archiver.rb +1 -1
  25. data/app/models/process/naf/log_reader.rb +141 -0
  26. data/app/models/process/naf/runner.rb +6 -49
  27. data/app/views/naf/application_schedule_affinity_tabs/_form.html.erb +1 -1
  28. data/app/views/naf/{applications → application_schedules}/_application_schedule_prerequisites.html.erb +1 -1
  29. data/app/views/naf/application_schedules/_form.html.erb +120 -0
  30. data/app/views/naf/application_schedules/edit.html.erb +11 -0
  31. data/app/views/naf/application_schedules/index.html.erb +47 -0
  32. data/app/views/naf/application_schedules/index.json.erb +8 -0
  33. data/app/views/naf/application_schedules/new.html.erb +11 -0
  34. data/app/views/naf/application_schedules/show.html.erb +130 -0
  35. data/app/views/naf/applications/_form.html.erb +44 -106
  36. data/app/views/naf/applications/_search_container.html.erb +29 -29
  37. data/app/views/naf/applications/index.html.erb +1 -10
  38. data/app/views/naf/applications/index.json.erb +22 -6
  39. data/app/views/naf/applications/show.html.erb +47 -97
  40. data/app/views/naf/logger_styles/_form.html.erb +0 -3
  41. data/app/views/naf/machines/_form.html.erb +3 -4
  42. data/config/routes.rb +3 -4
  43. data/db/migrate/20131219195439_add_run_interval_styles_table.rb +49 -0
  44. data/db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb +18 -0
  45. data/lib/naf/version.rb +1 -1
  46. data/naf.gemspec +1 -1
  47. data/spec/controllers/naf/application_schedule_affinity_tabs_controller_spec.rb +34 -27
  48. data/spec/controllers/naf/applications_controller_spec.rb +0 -48
  49. data/spec/factories/naf.rb +14 -8
  50. data/spec/models/logical/naf/application_spec.rb +9 -37
  51. data/spec/models/logical/naf/machine_spec.rb +1 -1
  52. data/spec/models/naf/application_schedule_spec.rb +38 -50
  53. data/spec/models/naf/application_spec.rb +3 -3
  54. data/spec/models/naf/historical_job_spec.rb +4 -2
  55. data/spec/models/naf/queued_job_spec.rb +2 -0
  56. data/spec/models/naf/run_interval_style_spec.rb +28 -0
  57. data/spec/models/naf/running_job_spec.rb +2 -0
  58. metadata +19 -7
  59. data/app/models/logical/naf/job_creator.rb +0 -151
  60. data/app/views/naf/applications/_application_schedule.html.erb +0 -80
  61. data/spec/models/logical/naf/job_creator_spec.rb +0 -102
data/README.rdoc CHANGED
@@ -1,7 +1,6 @@
1
1
  = Network Application Framework (Naf)
2
2
 
3
3
  Distributed Rails-based fault tolerant script scheduling framework, providing:
4
-
5
4
  * Quick prototyping
6
5
  * Logging
7
6
  * Scheduling
@@ -10,14 +9,39 @@ Distributed Rails-based fault tolerant script scheduling framework, providing:
10
9
  * Alarming
11
10
 
12
11
  With a management console, providing:
13
-
14
12
  * Machine Management
15
13
  * Live Queue Management
16
14
  * Process Management
17
15
  * Script Management
18
16
  * Schedule Management
19
17
 
20
- === Please find up-to-date information on Naf here: {Naf Wiki}[http://www.github.com/fiksu/naf/wiki]
18
+ === Built on top of Af
19
+ Naf is built on top of Af, which provides a supporting infrastructure through its Application class.
20
+ * Command line option parsing sets instance and class variables. Options can either have default values, can provide their own value parser or select from a number of pre-defined parsers.
21
+ * Logging is supported and done via log4r.
22
+ * Tight integration with Postgres allows administrators to easily find which scripts are executing db queries.
23
+ * Application components, such as ActiveRecord models, can add loggers and command line options.
24
+
25
+ === What is N/Af
26
+ Naf is simply a framework that we use to schedule, run, and monitor Af programs across a distributed network. It provides:
27
+ * Machine node redundancy (i.e. if a machine runner goes down, the other machine runners in the naf cluster can still run jobs).
28
+ * Script run dependencies allow applications to have prerequisites in order to prevent one application from running before another.
29
+ * Run restrictions, which prevent competing applications from running at the same time (i.e. if you have a scraper which is only allowed to have a single login active at a time, you can ensure it is only run when no other versions of the script is currently executing).
30
+ * A nice UI, where you can control all these features.
31
+
32
+ === Runners
33
+ Runners will queue an application if the application schedule is ready and it will check the queue every 30 seconds to see if there are available jobs to be run. Administrators can be alarmed when scripts fail to run, and when runners are down. In order to ensure that applications run on specific machines, use affinities.
21
34
 
35
+ === Affinities
36
+ Machines have affinity slots (which can be required) and applications have affinity tabs. For an application to be able to run on a machine, the machine’s affinity slots need to match all of the application's affinity tabs. And for a machine to be able to run an application, the application’s affinity tabs need to match all of the machine's required affinity slots.
37
+
38
+ Machines have an allocate-able number of slots of a specific affinity. Applications will allocate a number of these slots at run time, otherwise they will stay queued. This is a way to achieve load balancing, and prevent machines from running out of resources.
39
+
40
+ === Tags
41
+ Scripts have tags to describe the stage/progress of the process. They can be system or custom tags. All tags are visible by the user, so set tags at different stages of your script. This is a way of knowing what is happening in the script without having to take a look at the logs.
42
+
43
+
44
+ === Please find up-to-date information on Naf here: {Naf Wiki}[http://www.github.com/fiksu/naf/wiki]
22
45
  === Instructions on upgrading to Naf v1.1.4: {Instructions}[https://github.com/fiksu/naf/wiki/Upgrading-to-Naf-v1.1.4]
23
- === Instructions on upgrading to Naf v2.0.0: {Instructions}[https://github.com/fiksu/naf/wiki/Upgrading-to-Naf-v2.0]
46
+ === Instructions on upgrading to Naf v2.0: {Instructions}[https://github.com/fiksu/naf/wiki/Upgrading-to-Naf-v2.0]
47
+ === Instructions on upgrading to Naf v2.1: {Instructions}[https://github.com/fiksu/naf/wiki/Upgrading-to-Naf-v2.1]
data/RELEASE_NOTES.rdoc CHANGED
@@ -1,5 +1,13 @@
1
1
  = Release Notes
2
2
 
3
+ === Version 2.1.0
4
+
5
+ Featurs/Changes:
6
+ * Run interval styles determines the type schedule interval (daily, hourly, run, constant)
7
+ * Application can have many schedules
8
+ * Application run group quantum specifies the number of jobs queued during a schedule
9
+ * UI changes
10
+
3
11
  === Version 2.0.0
4
12
 
5
13
  Featurs/Changes:
@@ -0,0 +1,72 @@
1
+ // When document is ready
2
+ jQuery(document).ready(function() {
3
+
4
+ // Prepare for setup the datatable.
5
+ var dataTableOptions = {
6
+ "sAjaxSource": sAjaxSource,
7
+ "fnInitComplete" : function() {
8
+ initPageSelect();
9
+ },
10
+ "bAutoWidth": false,
11
+ "bSort": true,
12
+ "aoColumnDefs": [
13
+ { "bSortable": false, "aTargets": [9, 10] }, // turn off sorting
14
+ { "sClass": "center", "aTargets": [6, 7, 8] }
15
+ ],
16
+ "aoColumns": [
17
+ { "sWidth": "2%"}, // Id
18
+ { "sWidth": "15%"}, // Application
19
+ { "sWidth": "15%"}, // Run Group Name
20
+ { "sWidth": "9%"}, // Run Group Restriction
21
+ { "sWidth": "10%"}, // Run Interval Style
22
+ { "sWidth": "4%"}, // Run Interval
23
+ { "sWidth": "5%"}, // Run Group Quantum
24
+ { "sWidth": "5%"}, // Run Group Limit
25
+ { "sWidth": "5%"}, // Enqueue Backlogs
26
+ { "sWidth": "10%"}, // Affinities
27
+ { "sWidth": "10%"} // Prerequesites
28
+ ],
29
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
30
+ _.each(jQuery('.datatable_variable').serializeArray(), function(dv) { aoData.push(dv); });
31
+ jQuery.getJSON( sSource, aoData, function (json) {
32
+ fnCallback(json);
33
+ initPaging();
34
+ addTitles();
35
+ });
36
+ },
37
+ "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
38
+ colorizationDisabled(nRow, aData);
39
+ return nRow;
40
+ },
41
+ "sDom": "Rlfrtip"
42
+ };
43
+
44
+ // Setup the datatable
45
+ jQuery('#datatable').addDataTable(dataTableOptions);
46
+
47
+ jQuery(document).delegate('.enqueue', "click", function(){
48
+ var answer = confirm("Adding application as a job on the queue?");
49
+ if (!answer) {
50
+ return false;
51
+ }
52
+ jQuery.post(postSource, { "historical_job[application_id]": jQuery(this).attr('id') }, function(data) {
53
+ if (data.success) {
54
+ jQuery("<p id='notice'>Congratulations, a Job " + data.title + " was added!</p>").
55
+ appendTo('#flash_message').slideDown().delay(5000).slideUp();
56
+ jQuery('#datatable').dataTable().fnDraw();
57
+ }
58
+ else {
59
+ jQuery("<div class='error'>Sorry, \'" + data.title + "\' cannot add a Job to the queue right now!</div>").
60
+ appendTo('#flash_message').slideDown().delay(5000).slideUp();
61
+ jQuery('#datatable').dataTable().fnDraw();
62
+ }
63
+ });
64
+ });
65
+ });
66
+
67
+ function colorizationDisabled(nRow, aData) {
68
+ if (aData[11] == false) {
69
+ jQuery(nRow).addClass('deleted_or_hidden');
70
+ }
71
+ }
72
+
@@ -9,26 +9,17 @@ jQuery(document).ready(function() {
9
9
  },
10
10
  "bAutoWidth": false,
11
11
  "aoColumnDefs": [
12
- { "bVisible": false, "aTargets": [ 14, 15 ] }, // turn off visibility
13
- { "sClass": "center", "aTargets": [ 6, 7, 8, 9, 12, 13 ] }
12
+ { "sClass": "center", "aTargets": [ 6 ] }
14
13
  ],
15
14
  "aoColumns": [
16
- { "sWidth": "2%"}, // Id
17
- { "sWidth": "12%"}, // Title
18
- { "sWidth": "7%"}, // Short Name
19
- { "sWidth": "6%"}, // Script Type Name
20
- null, // Application Run Group Name
21
- { "sWidth": "9%"}, // Application Run Group Restriction Name
22
- { "sWidth": "7%"}, // Application Run Group Limit
23
- { "sWidth": "4%"}, // Enabled
24
- { "sWidth": "4%"}, // Enqueue Backlogs
25
- { "sWidth": "8%"}, // Run Time
26
- { "sWidth": "10%"}, // Last Queued At
27
- { "sWidth": "8%"}, // Affinities
28
- { "sWidth": "8%"}, // Prerequisites
29
- { "sWidth": "4%"}, // Actions
30
- null,
31
- null
15
+ { "sWidth": "3%"}, // Id
16
+ null, // Title
17
+ { "sWidth": "15%"}, // Short Name
18
+ { "sWidth": "10%"}, // Script Type Name
19
+ { "sWidth": "15%"}, // Application Schedules
20
+ { "sWidth": "15%"}, // Last Queued At
21
+ { "sWidth": "5%"} // Actions
22
+
32
23
  ],
33
24
  "fnServerData": function ( sSource, aoData, fnCallback ) {
34
25
  _.each(jQuery('.datatable_variable').serializeArray(), function(dv) { aoData.push(dv); });
@@ -77,13 +68,13 @@ function addLinkToApplication(nRow, aData) {
77
68
  }
78
69
 
79
70
  function colorizationDeletedOrHidden(nRow, aData) {
80
- if (aData[11] == 'true' || aData[12] == 'false' || aData[13] == '') {
71
+ if (aData[6] == 'true') {
81
72
  jQuery(nRow).addClass('deleted_or_hidden');
82
73
  }
83
74
  }
84
75
 
85
76
  function checkTimeFormat(nRow, aData) {
86
- var l_q_a_array = jQuery(aData[10]).text().split(',');
77
+ var l_q_a_array = jQuery(aData[5]).text().split(',');
87
78
  var last_queued_at;
88
79
  if(jQuery('#time_format').val() == 'lexically') {
89
80
  last_queued_at = l_q_a_array[0];
@@ -91,5 +82,5 @@ function checkTimeFormat(nRow, aData) {
91
82
  last_queued_at = l_q_a_array[1];
92
83
  }
93
84
 
94
- jQuery('td:nth-child(11)', nRow).empty().append(jQuery(aData[10]).text(last_queued_at));
85
+ jQuery('td:nth-child(6)', nRow).empty().append(jQuery(aData[5]).text(last_queued_at));
95
86
  }
@@ -33,16 +33,14 @@ module Naf
33
33
  end
34
34
 
35
35
  def create
36
- route_params = { application_id: params[:application_id],
37
- application_schedule_id: params[:application_schedule_id] }
36
+ route_params = { application_schedule_id: params[:application_schedule_id] }
38
37
  @application_schedule = Naf::ApplicationSchedule.find(params[:application_schedule_id])
39
- @application = Naf::Application.find(params[:application_id])
40
38
  @tab = Naf::ApplicationScheduleAffinityTab.new(params[:application_schedule_affinity_tab])
41
39
  if @tab.save
42
- redirect_to(naf.application_application_schedule_application_schedule_affinity_tab_path(@application, @application_schedule, @tab),
40
+ redirect_to(naf.application_schedule_application_schedule_affinity_tab_path(@application_schedule, @tab),
43
41
  notice: "Application Schedule Affinity Tab '#{@tab.affinity_name}' was successfully created.")
44
42
  else
45
- render route_params.merge(action: "new")
43
+ render route_params.merge(action: 'new')
46
44
  end
47
45
  end
48
46
 
@@ -55,12 +53,11 @@ module Naf
55
53
  def update
56
54
  @tab = Naf::ApplicationScheduleAffinityTab.find(params[:id])
57
55
  @application_schedule = Naf::ApplicationSchedule.find(params[:application_schedule_id])
58
- @application = Naf::Application.find(params[:application_id])
59
56
  if @tab.update_attributes(params[:application_schedule_affinity_tab])
60
- redirect_to(naf.application_application_schedule_application_schedule_affinity_tab_path(@application, @application_schedule, @tab),
57
+ redirect_to(naf.application_schedule_application_schedule_affinity_tab_path(@application_schedule, @tab),
61
58
  notice: "Application Schedule Affinity Tab '#{@tab.affinity_name}' was successfully updated.")
62
59
  else
63
- render action: "edit", application_schedule_id: @application_schedule.id, application_id: @application.id
60
+ render action: :edit, application_schedule_id: @application_schedule.id
64
61
  end
65
62
  end
66
63
 
@@ -0,0 +1,98 @@
1
+ module Naf
2
+ class ApplicationSchedulesController < Naf::ApplicationController
3
+
4
+ def index
5
+ respond_to do |format|
6
+ format.html
7
+ format.json do
8
+ application_schedules = []
9
+ application_schedule = []
10
+ @total_records = Naf::ApplicationSchedule.count(:all)
11
+ Logical::Naf::ApplicationSchedule.search(params).map(&:to_hash).map do |hash|
12
+ hash.map do |key, value|
13
+ value = '' if value.nil?
14
+ application_schedule << value
15
+ end
16
+ application_schedules << application_schedule
17
+ application_schedule = []
18
+ end
19
+
20
+ @total_display_records = application_schedules.count
21
+ @application_schedules = application_schedules.paginate(page: @page, per_page: @rows_per_page)
22
+
23
+ render layout: 'naf/layouts/jquery_datatables'
24
+ end
25
+ end
26
+ end
27
+
28
+ def show
29
+ schedule = ::Naf::ApplicationSchedule.find(params[:id])
30
+ @application_schedule = ::Logical::Naf::ApplicationSchedule.new(schedule)
31
+ end
32
+
33
+ def new
34
+ @application_schedule = Naf::ApplicationSchedule.new(application_id: params[:application_id])
35
+ end
36
+
37
+ def create
38
+ @application_schedule = Naf::ApplicationSchedule.new(params[:application_schedule])
39
+ check_application_run_group_name
40
+ set_application_run_group_name
41
+ if @application_schedule.save
42
+ redirect_to(@application_schedule.application, notice: "Application Schedule was successfully created.")
43
+ else
44
+ render action: :new
45
+ end
46
+ end
47
+
48
+ def edit
49
+ @application_schedule = ::Naf::ApplicationSchedule.find(params[:id])
50
+ check_application_run_group_name
51
+ if @application_schedule.application_schedule_prerequisites.blank?
52
+ @application_schedule.application_schedule_prerequisites.build
53
+ else
54
+ @show_prerequisite = true
55
+ end
56
+ end
57
+
58
+ def update
59
+ @application_schedule = ::Naf::ApplicationSchedule.find(params[:id])
60
+ set_application_run_group_name
61
+ if @application_schedule.update_attributes(params[:application_schedule])
62
+ redirect_to(@application_schedule, notice: "Application Schedule was successfully updated.")
63
+ else
64
+ render action: :edit
65
+ end
66
+ end
67
+
68
+ def destroy
69
+ @application_schedule = ::Naf::ApplicationSchedule.find(params[:id])
70
+ @application_schedule.destroy
71
+ flash[:notice] = 'Application Schedule was successfully deleted.'
72
+ redirect_to action: :index
73
+ end
74
+
75
+ def check_application_run_group_name
76
+ case @application_schedule.application_run_group_name
77
+ when @application_schedule.application.command
78
+ @run_group_name_type = 'command'
79
+ when nil, ''
80
+ @run_group_name_type = 'not set'
81
+ else
82
+ @run_group_name_type = 'custom'
83
+ end
84
+ end
85
+
86
+ def set_application_run_group_name
87
+ run_group_name_type = params[:run_group_name_type]
88
+ case run_group_name_type
89
+ when 'command'
90
+ params[:application_schedule][:application_run_group_name] =
91
+ ::Naf::Application.find_by_id(params[:application_schedule][:application_id]).command
92
+ when 'not set'
93
+ params[:application_schedule][:application_run_group_name] = nil
94
+ end
95
+ end
96
+
97
+ end
98
+ end
@@ -1,7 +1,6 @@
1
1
  module Naf
2
2
  class ApplicationsController < Naf::ApplicationController
3
3
 
4
- before_filter :set_cols_and_attributes
5
4
  before_filter :set_rows_per_page
6
5
 
7
6
  def index
@@ -12,8 +11,7 @@ module Naf
12
11
 
13
12
  applications = []
14
13
  application = []
15
- params[:search][:visible] = params[:search][:visible] ? false : true
16
- params[:search][:deleted] = params[:search][:deleted] ? false : "false"
14
+ params[:search][:deleted] = params[:search][:deleted] ? false : 'false'
17
15
  @total_records = Naf::Application.count(:all)
18
16
  Logical::Naf::Application.search(params[:search]).map(&:to_hash).map do |hash|
19
17
  hash.map do |key, value|
@@ -21,7 +19,7 @@ module Naf
21
19
  application << value
22
20
  end
23
21
  applications << application
24
- application =[]
22
+ application = []
25
23
  end
26
24
  @total_display_records = applications.count
27
25
  @applications = applications.paginate(page: @page, per_page: @rows_per_page)
@@ -38,119 +36,29 @@ module Naf
38
36
 
39
37
  def new
40
38
  @application = Naf::Application.new
41
- app_schedule = @application.build_application_schedule
42
- app_schedule.application_schedule_prerequisites.build
43
39
  end
44
40
 
45
41
  def create
46
42
  @application = Naf::Application.new(params[:application])
47
- check_application_run_group_name
48
- set_application_run_group_name
49
43
  if @application.save
50
- app_schedule = @application.application_schedule
51
- @application.update_attributes(params[:application])
52
- if app_schedule.present?
53
- prerequisites =
54
- app_schedule.prerequisites.map do |prerequisite|
55
- prerequisite.title
56
- end.join(', ')
57
- end
58
- redirect_to(@application,
59
- notice: "Application #{@application.title} was successfully created. #{'Prerequisites: ' + prerequisites if app_schedule.try(:prerequisites).try(:present?) }")
44
+ redirect_to(@application, notice: "Application #{@application.title} was successfully created.")
60
45
  else
61
- set_shown_schedule_and_prerequisite
62
- @application.build_application_schedule unless params[:application].try(:[], :application_schedule_attributes).try(:[], :_destroy) == "0"
63
- render action: "new"
46
+ render action: :new
64
47
  end
65
48
  end
66
49
 
67
50
  def edit
68
51
  @application = Naf::Application.find(params[:id])
69
- check_application_run_group_name
70
- app_schedule = @application.application_schedule
71
- if app_schedule.blank?
72
- build_app_schedule = @application.build_application_schedule
73
- build_app_schedule.application_schedule_prerequisites.build
74
- else
75
- @show_app_schedule = true
76
- if app_schedule.application_schedule_prerequisites.blank?
77
- app_schedule.application_schedule_prerequisites.build
78
- else
79
- @show_prerequisite = true
80
- end
81
- end
82
52
  end
83
53
 
84
54
  def update
85
55
  @application = Naf::Application.find(params[:id])
86
- set_application_run_group_name
87
56
  if @application.update_attributes(params[:application])
88
- app_schedule = @application.application_schedule
89
- if app_schedule.present?
90
- prerequisites =
91
- app_schedule.prerequisites.map do |prerequisite|
92
- prerequisite.title
93
- end.join(', ')
94
- end
95
- redirect_to(@application,
96
- notice: "Application #{@application.title} was successfully updated. #{'Prerequisites: ' + prerequisites if app_schedule.try(:prerequisites).try(:present?) }")
57
+ redirect_to(@application, notice: "Application #{@application.title} was successfully updated.")
97
58
  else
98
- set_shown_schedule_and_prerequisite
99
- render action: "edit"
100
- end
101
- end
102
-
103
- private
104
-
105
- def set_cols_and_attributes
106
- more_attributes = [:script_type_name,
107
- :application_run_group_name,
108
- :application_run_group_restriction_name,
109
- :run_interval,
110
- :run_start_minute,
111
- :priority,
112
- :application_run_group_limit,
113
- :visible,
114
- :enabled,
115
- :enqueue_backlogs ]
116
- @attributes = Naf::Application.attribute_names.map(&:to_sym) | more_attributes
117
- @cols = Logical::Naf::Application::COLUMNS
118
- end
119
-
120
- def set_application_run_group_name
121
- @run_group_name_type = params[:run_group_name_type]
122
- case @run_group_name_type
123
- when "command"
124
- params[:application][:application_schedule_attributes][:application_run_group_name] = params[:application][:command]
125
- when "not set"
126
- params[:application][:application_schedule_attributes][:application_run_group_name] = nil
127
- end
128
- end
129
-
130
- def check_application_run_group_name
131
- case @application.application_schedule.try(:application_run_group_name)
132
- when @application.command
133
- @run_group_name_type = "command"
134
- when nil, ''
135
- @run_group_name_type = "not set"
136
- else
137
- @run_group_name_type = "custom"
138
- end
139
- end
140
-
141
- def set_shown_schedule_and_prerequisite
142
- if params[:application].try(:[], :application_schedule_attributes).try(:[], :_destroy) == "0"
143
- @show_app_schedule = true
144
- unless params[:application].try(:[], :application_schedule_attributes).
145
- try(:[], :application_schedule_prerequisites_attributes).
146
- try(:select) do |key, value|
147
- value.try(:[], :_destroy) == "false"
148
- end.blank?
149
- @show_prerequisite = true
150
- end
59
+ render action: :edit
151
60
  end
152
61
  end
153
62
 
154
63
  end
155
-
156
64
  end