app/models/user_analysis.rb
# construct and import a new user_analysis specific WDL into the methods repo to benchmark against this reference_analysis
construct and import a new user_analysis specific WDL into the methods repo to benchmark against this reference_analysis
construct and import a new user_analysis specific WDL into the methods repo to benchmark against this reference_analysis
def create_orchestration_workflow
    begin
      Rails.logger.info "Creating custom orchestration WDL for #{self.full_name}"
      orchestration_namespace, orchestration_name, orchestration_snapshot = self.reference_analysis.extract_wdl_keys(:orchestration_wdl)
      orchestration_wdl = ApplicationController.fire_cloud_client.get_method(orchestration_namespace, orchestration_name,
                                                                             orchestration_snapshot.to_i, true)
      orchestration_wdl_contents = orchestration_wdl.split("\n")
      analysis_index = orchestration_wdl_contents.index {|import| import =~ /#{self.reference_analysis.wdl_import_url(:analysis_wdl)}/}
      reformatted_import = orchestration_wdl_contents[analysis_index].gsub(/#{self.reference_analysis.wdl_import_url(:analysis_wdl)}/,
                                                                           "#{self.wdl_import_url}")
      orchestration_wdl_contents[analysis_index] = reformatted_import
      new_method_name = self.orchestration_name
      synopsis = "Custom orchestration for #{self.name}"
      Rails.logger.info "Importing #{self.namespace}/#{new_method_name} into methods repo"
      user_client = FireCloudClient.new(self.user)
      updated_orchestration = user_client.create_method(self.namespace, new_method_name, synopsis, orchestration_wdl_contents.join("\n"))
      Rails.logger.info "Import of #{updated_orchestration['namespace']}/#{updated_orchestration['name']}/#{updated_orchestration['snapshotId']} successful"
      updated_orchestration
    rescue => e
      Rails.logger.error "Unable to create custom orchestration WDL for #{self.full_name}: #{e.message}"
      e.message
    end
  end
def create_orchestration_workflow begin Rails . logger . info "Creating custom orchestration WDL for #{self.full_name}" orchestration_namespace , orchestration_name , orchestration_snapshot = self . reference_analysis . extract_wdl_keys ( :orchestration_wdl ) orchestration_wdl = ApplicationController . fire_cloud_client . get_method ( orchestration_namespace , orchestration_name , orchestration_snapshot . to_i , true ) orchestration_wdl_contents = orchestration_wdl . split ( "\n" ) analysis_index = orchestration_wdl_contents . index { | import | import =~ / #{ self . reference_analysis . wdl_import_url ( :analysis_wdl ) } / } reformatted_import = orchestration_wdl_contents [ analysis_index ] . gsub ( / #{ self . reference_analysis . wdl_import_url ( :analysis_wdl ) } / , "#{self.wdl_import_url}" ) orchestration_wdl_contents [ analysis_index ] = reformatted_import new_method_name = self . orchestration_name synopsis = "Custom orchestration for #{self.name}" Rails . logger . info "Importing #{self.namespace}/#{new_method_name} into methods repo" user_client = FireCloudClient . new ( self . user ) updated_orchestration = user_client . create_method ( self . namespace , new_method_name , synopsis , orchestration_wdl_contents . join ( "\n" ) ) Rails . logger . info "Import of #{updated_orchestration['namespace']}/#{updated_orchestration['name']}/#{updated_orchestration['snapshotId']} successful" updated_orchestration rescue => e Rails . logger . error "Unable to create custom orchestration WDL for #{self.full_name}: #{e.message}" e . message end end
construct and import a new user_analysis specific WDL into the methods repo to benchmark against this reference_analysis
construct and import a new user_analysis specific WDL into the methods repo to benchmark against this reference_analysis
# get orchestration WDL contents # find the original analysis_wdl import and replace with user_analyis.wdl_import_url # add method to FireCloud Methods Repo