@@ -7,7 +7,7 @@ class Launcher
77
88 class ClusterNotFound < StandardError ; end
99
10- attr_reader :title , :id , :created_at , :project_dir , :smart_attributes
10+ attr_reader :title , :id , :created_at , :project_dir , :cacheless_attributes , : smart_attributes
1111
1212 class << self
1313 def launchers_dir ( project_dir )
@@ -78,14 +78,20 @@ def initialize(opts = {})
7878 add_required_fields ( **sm_opts )
7979 # add defaults if it's a brand new launcher with only title and directory.
8080 add_default_fields ( **sm_opts ) if opts . size <= 2
81+
82+ # we generate two sets of attributes here depending on whether we want the initial
83+ # form values to come from the form defaults or from the cache.
84+ @cacheless_attributes = build_smart_attributes ( **sm_opts , use_cache : false )
8185 @smart_attributes = build_smart_attributes ( **sm_opts )
8286 end
8387
84- def build_smart_attributes ( form : [ ] , attributes : { } )
88+ def build_smart_attributes ( form : [ ] , attributes : { } , use_cache : true )
8589 form . map do |form_item_id |
8690 attrs = attributes [ form_item_id . to_sym ] . to_h . symbolize_keys
87- cache_value = cached_values [ form_item_id ]
88- attrs [ :value ] = cache_value if cache_value . present?
91+ if use_cache
92+ cache_value = cached_values [ form_item_id ]
93+ attrs [ :value ] = cache_value if cache_value . present?
94+ end
8995 SmartAttributes ::AttributeFactory . build ( form_item_id , attrs )
9096 end
9197 end
@@ -190,7 +196,7 @@ def update(params)
190196 update_attributes ( params )
191197 end
192198
193- def submit ( options )
199+ def submit ( options , write_cache : true )
194200 cluster_id = if options . has_key? ( :auto_batch_clusters )
195201 options [ :auto_batch_clusters ]
196202 else
@@ -206,7 +212,7 @@ def submit(options)
206212 adapter . submit ( job_script , **dependency_helper ( options ) )
207213 end
208214 update_job_log ( job_id , cluster_id . to_s )
209- write_job_options_to_cache ( options )
215+ write_job_options_to_cache ( options ) if write_cache
210216
211217 job_id
212218 rescue StandardError => e
0 commit comments