app/controllers/user_workspaces_controller.rb
# create a benchmark_analysis (custom orchestration workflow) for use in a user_workspace
create a benchmark_analysis (custom orchestration workflow) for use in a user_workspace
create a benchmark_analysis ( custom orchestration workflow ) for use in a user_workspace
def create_benchmark_analysis
    benchmark_analysis_wdl = @user_analysis.create_orchestration_workflow
    user_client = user_fire_cloud_client(current_user)
    if benchmark_analysis_wdl.is_a?(Hash)
      benchmark_analysis_config = @user_analysis.create_orchestration_config(benchmark_analysis_wdl)
      if benchmark_analysis_config.is_a?(Hash)
        @benchmark_analysis = @user_analysis.benchmark_analyses.build(user: @user_workspace.user,
                                                                      name: benchmark_analysis_wdl['name'],
                                                                      namespace: benchmark_analysis_wdl['namespace'],
                                                                      snapshot: benchmark_analysis_wdl['snapshotId'].to_i,
                                                                      configuration_name: benchmark_analysis_config['name'],
                                                                      configuration_namespace: benchmark_analysis_config['namespace'],
                                                                      configuration_snapshot: benchmark_analysis_config['methodConfigVersion'])
        if @benchmark_analysis.save
          begin
            submission = user_client.create_workspace_submission(@user_workspace.namespace,
                                                                 @user_workspace.name,
                                                                 @benchmark_analysis.configuration_namespace,
                                                                 @benchmark_analysis.configuration_name)
            redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),
                        notice: "'#{@benchmark_analysis.full_name}' was successfully created and submitted (submission: #{submission['submissionId']})" and return
          rescue => e
            redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),
                        alert: "'#{@benchmark_analysis.full_name}' was successfully created, but failed to submit due to an error: #{e.message})" and return
          end
        else
          error_msg = @benchmark_analysis.errors.full_messages.join(', ')
          logger.error "Unable to create benchmark analysis for #{@user_analysis.full_name} due to error: #{error_msg}"
          redact_workflow(current_user, benchmark_analysis_wdl['namespace'], benchmark_analysis_wdl['name'], benchmark_analysis_wdl['snapshotId'].to_i)
          redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),
                      alert: "We were unable to create this benchmark due to the following errors: #{error_msg})" and return
        end
      else
        logger.error "Unable to create orchestration config for #{@user_analysis.full_name} due to error: #{benchmark_analysis_config}"
        redact_workflow(current_user, benchmark_analysis_wdl['namespace'], benchmark_analysis_wdl['name'], benchmark_analysis_wdl['snapshotId'].to_i)
        redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),
                    alert: "We were unable to create this benchmark due to the following errors: #{benchmark_analysis_config}" and return
      end
    else
      logger.error "Unable to create orchestration workflow for #{@user_analysis.full_name} due to error: #{benchmark_analysis_wdl}"
      redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),
                  alert: "We were unable to create this benchmark due to the following errors: #{benchmark_analysis_wdl}" and return
    end
  end
def create_benchmark_analysis benchmark_analysis_wdl = @user_analysis . create_orchestration_workflow user_client = user_fire_cloud_client ( current_user ) if benchmark_analysis_wdl . is_a? ( Hash ) benchmark_analysis_config = @user_analysis . create_orchestration_config ( benchmark_analysis_wdl ) if benchmark_analysis_config . is_a? ( Hash ) @benchmark_analysis = @user_analysis . benchmark_analyses . build ( user : @user_workspace . user , name : benchmark_analysis_wdl [ 'name' ] , namespace : benchmark_analysis_wdl [ 'namespace' ] , snapshot : benchmark_analysis_wdl [ 'snapshotId' ] . to_i , configuration_name : benchmark_analysis_config [ 'name' ] , configuration_namespace : benchmark_analysis_config [ 'namespace' ] , configuration_snapshot : benchmark_analysis_config [ 'methodConfigVersion' ] ) if @benchmark_analysis . save begin submission = user_client . create_workspace_submission ( @user_workspace . namespace , @user_workspace . name , @benchmark_analysis . configuration_namespace , @benchmark_analysis . configuration_name ) redirect_to user_workspace_path ( project : @user_workspace . namespace , name : @user_workspace . name ) , notice : "'#{@benchmark_analysis.full_name}' was successfully created and submitted (submission: #{submission['submissionId']})" and return rescue => e redirect_to user_workspace_path ( project : @user_workspace . namespace , name : @user_workspace . name ) , alert : "'#{@benchmark_analysis.full_name}' was successfully created, but failed to submit due to an error: #{e.message})" and return end else error_msg = @benchmark_analysis . errors . full_messages . join ( ', ' ) logger . error "Unable to create benchmark analysis for #{@user_analysis.full_name} due to error: #{error_msg}" redact_workflow ( current_user , benchmark_analysis_wdl [ 'namespace' ] , benchmark_analysis_wdl [ 'name' ] , benchmark_analysis_wdl [ 'snapshotId' ] . to_i ) redirect_to user_workspace_path ( project : @user_workspace . namespace , name : @user_workspace . name ) , alert : "We were unable to create this benchmark due to the following errors: #{error_msg})" and return end else logger . error "Unable to create orchestration config for #{@user_analysis.full_name} due to error: #{benchmark_analysis_config}" redact_workflow ( current_user , benchmark_analysis_wdl [ 'namespace' ] , benchmark_analysis_wdl [ 'name' ] , benchmark_analysis_wdl [ 'snapshotId' ] . to_i ) redirect_to user_workspace_path ( project : @user_workspace . namespace , name : @user_workspace . name ) , alert : "We were unable to create this benchmark due to the following errors: #{benchmark_analysis_config}" and return end else logger . error "Unable to create orchestration workflow for #{@user_analysis.full_name} due to error: #{benchmark_analysis_wdl}" redirect_to user_workspace_path ( project : @user_workspace . namespace , name : @user_workspace . name ) , alert : "We were unable to create this benchmark due to the following errors: #{benchmark_analysis_wdl}" and return end end
create a benchmark_analysis (custom orchestration workflow) for use in a user_workspace
create a benchmark_analysis ( custom orchestration workflow ) for use in a user_workspace
# go ahead and submit this new benchmark_analysis # redact workflow # redact workflow