diff --git a/apps/dashboard/app/controllers/launchers_controller.rb b/apps/dashboard/app/controllers/launchers_controller.rb
index 65d8b25312..a90b63dd58 100644
--- a/apps/dashboard/app/controllers/launchers_controller.rb
+++ b/apps/dashboard/app/controllers/launchers_controller.rb
@@ -14,7 +14,8 @@ class LaunchersController < ApplicationController
:auto_batch_clusters, :auto_batch_clusters_exclude, :auto_batch_clusters_fixed,
:bc_num_slots, :bc_num_slots_fixed, :bc_num_slots_min, :bc_num_slots_max,
:bc_num_hours, :bc_num_hours_fixed, :bc_num_hours_min, :bc_num_hours_max,
- :auto_job_name, :auto_job_name_fixed
+ :auto_job_name, :auto_job_name_fixed,
+ :auto_log_location, :auto_log_location_fixed
].freeze
def new
diff --git a/apps/dashboard/app/helpers/launchers_helper.rb b/apps/dashboard/app/helpers/launchers_helper.rb
index 4ee86e1e6e..b186e49af2 100644
--- a/apps/dashboard/app/helpers/launchers_helper.rb
+++ b/apps/dashboard/app/helpers/launchers_helper.rb
@@ -70,6 +70,10 @@ def auto_cores_template
create_editable_widget(script_form_double, attrib)
end
+ def auto_log_location_template
+ attrib = SmartAttributes::AttributeFactory.build_auto_log_location
+ create_editable_widget(script_form_double, attrib)
+ end
# We need a form builder to build the template divs. These are
# templates so that they are not a part of the _actual_ form (yet).
# Otherwise you'd have required fields that you cannot actually edit
diff --git a/apps/dashboard/app/javascript/launcher_edit.js b/apps/dashboard/app/javascript/launcher_edit.js
index d9c2f3c49e..738ea6b3d1 100644
--- a/apps/dashboard/app/javascript/launcher_edit.js
+++ b/apps/dashboard/app/javascript/launcher_edit.js
@@ -19,6 +19,10 @@ const newFieldData = {
label: "Job Name",
help: "The name the job will have."
},
+ auto_log_location: {
+ label: "Log Location",
+ help: "The destination of the job's log output."
+ },
bc_num_slots: {
label: "Nodes",
help: "How many nodes the job will run on."
diff --git a/apps/dashboard/app/lib/smart_attributes.rb b/apps/dashboard/app/lib/smart_attributes.rb
index 285a0c4aa2..8beb15ddda 100644
--- a/apps/dashboard/app/lib/smart_attributes.rb
+++ b/apps/dashboard/app/lib/smart_attributes.rb
@@ -10,6 +10,7 @@ module SmartAttributes
require 'smart_attributes/attributes/auto_groups'
require 'smart_attributes/attributes/auto_job_name'
require 'smart_attributes/attributes/auto_modules'
+ require 'smart_attributes/attributes/auto_log_location'
require 'smart_attributes/attributes/auto_primary_group'
require 'smart_attributes/attributes/auto_queues'
require 'smart_attributes/attributes/auto_qos'
diff --git a/apps/dashboard/app/lib/smart_attributes/attributes/auto_log_location.rb b/apps/dashboard/app/lib/smart_attributes/attributes/auto_log_location.rb
new file mode 100644
index 0000000000..1157b22fa6
--- /dev/null
+++ b/apps/dashboard/app/lib/smart_attributes/attributes/auto_log_location.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+module SmartAttributes
+ class AttributeFactory
+ # Build this attribute object. Must specify a valid directory in opts
+ #
+ # @param opts [Hash] attribute's options
+ # @return [Attributes::AutoLogLocation] the attribute object
+ def self.build_auto_log_location(opts = {})
+ Attributes::AutoLogLocation.new('auto_log_location', opts)
+ end
+ end
+
+ module Attributes
+ class AutoLogLocation < Attribute
+ # Value of auto_log_location attribute
+ # Defaults to first script path in the project
+ # @return [String] attribute value
+ def value
+ opts[:value].presence
+ end
+
+ def widget
+ 'text_field'
+ end
+
+ def label(*)
+ # (opts[:label] || 'Log Location').to_s
+ (opts[:label] || I18n.t('dashboard.auto_log_location_title')).to_s
+ end
+
+ # Submission hash describing how to submit this attribute
+ # @param fmt [String, nil] formatting of hash
+ # @return [Hash] submission hash
+ def submit(*)
+ { script: { output_path: value } }
+ end
+ end
+ end
+end
diff --git a/apps/dashboard/app/views/launchers/edit.html.erb b/apps/dashboard/app/views/launchers/edit.html.erb
index 9f222c8ccf..25d79fb6fe 100644
--- a/apps/dashboard/app/views/launchers/edit.html.erb
+++ b/apps/dashboard/app/views/launchers/edit.html.erb
@@ -43,4 +43,8 @@
<%= auto_cores_template %>
-
\ No newline at end of file
+
+
+
+ <%= auto_log_location_template %>
+
diff --git a/apps/dashboard/config/locales/en.yml b/apps/dashboard/config/locales/en.yml
index 68331777cc..48314bdf85 100644
--- a/apps/dashboard/config/locales/en.yml
+++ b/apps/dashboard/config/locales/en.yml
@@ -276,6 +276,8 @@ en:
deleted_message: "Saved settings %{settings_name} deleted."
settings_values_label: "Values"
outdated_message: "%{app_title} parameters have changed since these settings were created."
+
+ auto_log_location_title: "Log Location"
user_configuration:
support_ticket_error: "support_ticket is misconfigured. \"email\" or \"rt_api\" sections are required in the configuration YAML."
diff --git a/apps/dashboard/config/locales/ja_JP.yml b/apps/dashboard/config/locales/ja_JP.yml
index 65b42fe4bb..1b69c45e6b 100644
--- a/apps/dashboard/config/locales/ja_JP.yml
+++ b/apps/dashboard/config/locales/ja_JP.yml
@@ -11,3 +11,4 @@ ja_JP:
show: "見せる"
# project: "Project"
# directory: "Directory"
+ auto_log_location_title: "ログの場所"
\ No newline at end of file
diff --git a/apps/dashboard/config/locales/zh-CN.yml b/apps/dashboard/config/locales/zh-CN.yml
index 59e305c35d..c8050c1dd4 100644
--- a/apps/dashboard/config/locales/zh-CN.yml
+++ b/apps/dashboard/config/locales/zh-CN.yml
@@ -140,6 +140,8 @@ zh-CN:
可以从上方导航栏中的下拉菜单访问群集访问应用程序。
自定义共享应用程序可以在下面使用。
+ auto_log_location_title: "日志位置"
+
# all_apps_table_app_column: "Name"
# all_apps_table_category_column: "Category"
# all_apps_table_sub_category_column: "Sub Category"
diff --git a/apps/dashboard/test/lib/smart_attributes/auto_log_location_test.rb b/apps/dashboard/test/lib/smart_attributes/auto_log_location_test.rb
new file mode 100644
index 0000000000..2d39d08b1c
--- /dev/null
+++ b/apps/dashboard/test/lib/smart_attributes/auto_log_location_test.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+require 'smart_attributes'
+
+module SmartAttributes
+ class AutoLogLocationTest < ActiveSupport::TestCase
+ def setup
+ stub_clusters
+ stub_user
+ stub_sacctmgr
+ end
+
+ def dynamic_env
+ {
+ OOD_BC_DYNAMIC_JS: 'true'
+ }
+ end
+
+ test 'correctly sets the user supplied value' do
+ with_modified_env(dynamic_env) do
+ options = {
+ value: 'logerrific_locale',
+ label: 'Log Location'
+ }
+ attribute = SmartAttributes::AttributeFactory.build('auto_log_location', options)
+
+ assert_equal('logerrific_locale', attribute.value)
+ end
+ end
+
+ test 'correctly sets the default value in place of empty string' do
+ with_modified_env(dynamic_env) do
+ options = {
+ value: '',
+ label: 'Log Location'
+ }
+ attribute = SmartAttributes::AttributeFactory.build('auto_log_location', options)
+
+ assert_equal(nil, attribute.value)
+ end
+ end
+
+ test 'correctly sets the default value in place of nil string' do
+ with_modified_env(dynamic_env) do
+ options = {
+ value: nil,
+ label: 'Log Location'
+ }
+ attribute = SmartAttributes::AttributeFactory.build('auto_log_location', options)
+
+ assert_equal(nil, attribute.value)
+ end
+ end
+ end
+end
diff --git a/apps/dashboard/test/system/project_manager_test.rb b/apps/dashboard/test/system/project_manager_test.rb
index aadbf3d6b2..b9694386e9 100644
--- a/apps/dashboard/test/system/project_manager_test.rb
+++ b/apps/dashboard/test/system/project_manager_test.rb
@@ -506,7 +506,8 @@ def add_auto_environment_variable(project_id, script_id, save: true)
actual_new_options = page.all("##{new_field_id} option").map(&:value).to_set
expected_new_options = [
'bc_num_hours', 'auto_queues', 'bc_num_slots', 'auto_cores',
- 'auto_accounts', 'auto_job_name', 'auto_environment_variable'
+ 'auto_accounts', 'auto_job_name', 'auto_environment_variable',
+ 'auto_log_location'
].to_set
assert_equal expected_new_options, actual_new_options
end