app/models/user_analysis.rb
# create a configuration object to run this user_analysis in a benchmark submission
create a configuration object to run this user_analysis in a benchmark submission
create a configuration object to run this user_analysis in a benchmark submission
def create_orchestration_config(orchestration_workflow)
    begin
      Rails.logger.info "Creating custom orchestration config for #{self.full_name}"
      orchestration_namespace, orchestration_name, orchestration_snapshot = self.reference_analysis.extract_wdl_keys(:orchestration_wdl)
      user_client = FireCloudClient.new(self.user)
      workspace_configs = user_client.get_workspace_configurations(self.user_workspace.namespace, self.user_workspace.name)
      matching_config = workspace_configs.find do |config|
          config['methodRepoMethod']['methodName'] == orchestration_name &&
          config['methodRepoMethod']['methodNamespace'] == orchestration_namespace &&
          config['methodRepoMethod']['methodVersion'] == orchestration_snapshot.to_i
      end
      if matching_config.present?
        Rails.logger.info "Found matching config for #{self.full_name}: #{matching_config['namespace']}/#{matching_config['name']}"
        orchestration_config = user_client.get_workspace_configuration(self.user_workspace.namespace, self.user_workspace.name,
                                                                       matching_config['namespace'], matching_config['name'])
        orchestration_config['methodRepoMethod']['methodUri'] = generate_source_repo_url(orchestration_workflow, orchestration_config)
        orchestration_config['namespace'] = self.namespace
        orchestration_config['name'] = self.orchestration_name
        Rails.logger.info "Saving config for #{self.full_name} as #{orchestration_config['namespace']}/#{orchestration_config['name']}"
        new_workspace_config = user_client.create_workspace_configuration(self.user_workspace.namespace,
                                                                    self.user_workspace.name, orchestration_config)
        Rails.logger.info "Orchestration config for #{self.full_name} successfully saved"
        new_workspace_config['methodConfiguration'] 
      else
        raise RuntimeError.new "orchestration config not found for #{self.reference_analysis.orchestration_wdl}"
      end
    rescue => e
      Rails.logger.error "Unable to create custom orchestration config for #{self.full_name} due to an error: #{e.message}"
      e.message
    end
  end
def create_orchestration_config ( orchestration_workflow ) begin Rails . logger . info "Creating custom orchestration config for #{self.full_name}" orchestration_namespace , orchestration_name , orchestration_snapshot = self . reference_analysis . extract_wdl_keys ( :orchestration_wdl ) user_client = FireCloudClient . new ( self . user ) workspace_configs = user_client . get_workspace_configurations ( self . user_workspace . namespace , self . user_workspace . name ) matching_config = workspace_configs . find do | config | config [ 'methodRepoMethod' ] [ 'methodName' ] == orchestration_name && config [ 'methodRepoMethod' ] [ 'methodNamespace' ] == orchestration_namespace && config [ 'methodRepoMethod' ] [ 'methodVersion' ] == orchestration_snapshot . to_i end if matching_config . present? Rails . logger . info "Found matching config for #{self.full_name}: #{matching_config['namespace']}/#{matching_config['name']}" orchestration_config = user_client . get_workspace_configuration ( self . user_workspace . namespace , self . user_workspace . name , matching_config [ 'namespace' ] , matching_config [ 'name' ] ) orchestration_config [ 'methodRepoMethod' ] [ 'methodUri' ] = generate_source_repo_url ( orchestration_workflow , orchestration_config ) orchestration_config [ 'namespace' ] = self . namespace orchestration_config [ 'name' ] = self . orchestration_name Rails . logger . info "Saving config for #{self.full_name} as #{orchestration_config['namespace']}/#{orchestration_config['name']}" new_workspace_config = user_client . create_workspace_configuration ( self . user_workspace . namespace , self . user_workspace . name , orchestration_config ) Rails . logger . info "Orchestration config for #{self.full_name} successfully saved" new_workspace_config [ 'methodConfiguration' ] else raise RuntimeError . new "orchestration config not found for #{self.reference_analysis.orchestration_wdl}" end rescue => e Rails . logger . error "Unable to create custom orchestration config for #{self.full_name} due to an error: #{e.message}" e . message end end
create a configuration object to run this user_analysis in a benchmark submission
create a configuration object to run this user_analysis in a benchmark submission
# now set configuration method URI to use newly created custom orchestration WDL (this overrides the methodRepo name, namespace settings) # if the user_analysis is valid, then the inputs/outputs match the existing reference_analysis and the config is valid # return just config object
orchestration_workflow
<not_specific>