Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide fixed attributes #3745

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/dashboard/app/models/launcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,21 @@ def update(params)
end

def submit(options)
adapter = adapter(options[:auto_batch_clusters]).job_adapter
cluster_id = if options.has_key?(:auto_batch_clusters)
options[:auto_batch_clusters]
else
smart_attributes.find { |sm| sm.id == 'auto_batch_clusters' }.value.to_sym
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reformat this more like this? I'm guessing we need this addition in the case that auto_batch_clusters is fixed?

    cluster_id = if options.has_key?(:auto_batch_clusters)
                   options[:auto_batch_clusters]
                 else
                   smart_attributes.find { |sm| sm.id == 'auto_batch_clusters' }.value.to_sym
                 end

adapter = adapter(cluster_id).job_adapter

render_format = adapter.class.name.split('::').last.downcase

job_script = OodCore::Job::Script.new(**submit_opts(options, render_format))

job_id = Dir.chdir(project_dir) do
adapter.submit(job_script)
end
update_job_log(job_id, options[:auto_batch_clusters].to_s)
update_job_log(job_id, cluster_id.to_s)
write_job_options_to_cache(options)

job_id
Expand Down Expand Up @@ -345,7 +351,7 @@ def job_log_file

def submit_opts(options, render_format)
smart_attributes.map do |sm|
sm.value = options[sm.id.to_sym]
sm.value = options[sm.id.to_sym] unless sm.fixed?
sm
end.map do |sm|
sm.submit(fmt: render_format)
Expand Down
3 changes: 0 additions & 3 deletions apps/dashboard/app/views/launchers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
<% @script.smart_attributes.each do |attrib| %>
<%# TODO generate render_format %>
<%= create_widget(f, attrib, format: nil) %>
<% if attrib.fixed? %>
<%= f.hidden_field(attrib.id, attrib.field_options) %>
<% end %>
<% end %>

<div class="d-grid gap-2">
Expand Down
Loading