From 796e552a6e6307f159f4240cf5290d9c5e74492e Mon Sep 17 00:00:00 2001 From: Fritz Freiheit Date: Thu, 3 Nov 2022 09:54:56 -0400 Subject: [PATCH] DEEPBLUE-147 - Globus dashboard - 10 --- app/jobs/globus_copy_job.rb | 7 ++++++- app/services/deepblue/globus_integration_service.rb | 3 +++ app/services/deepblue/globus_service.rb | 12 +++++++----- config/initializers/globus_service_integration.rb | 3 +++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/jobs/globus_copy_job.rb b/app/jobs/globus_copy_job.rb index 83892281..f2c02d00 100644 --- a/app/jobs/globus_copy_job.rb +++ b/app/jobs/globus_copy_job.rb @@ -8,7 +8,12 @@ class GlobusCopyJob < GlobusJob # @param [boolean, false] generate_error # @param [integer, 0 ] delay_per_file_seconds # @param [String, nil ] user_email - def perform( concern_id, log_prefix: "Globus: ", generate_error: false, delay_per_file_seconds: 0, user_email: nil ) + def perform( concern_id, + log_prefix: "Globus: ", + generate_error: ::Deepblue::GlobusIntegrationService.globus_default_generate_error_on_copy, + delay_per_file_seconds: ::Deepblue::GlobusIntegrationService.globus_default_delay_per_file_seconds_on_copy, + user_email: nil ) + globus_job_perform( concern_id: concern_id, email: user_email, log_prefix: "#{log_prefix}globus_copy_job" ) do ::Deepblue::LoggingHelper.debug "#{@globus_log_prefix} begin copy" unless @globus_job_quiet GlobusJob.error_file_delete @globus_concern_id diff --git a/app/services/deepblue/globus_integration_service.rb b/app/services/deepblue/globus_integration_service.rb index 4d727fca..58badd81 100644 --- a/app/services/deepblue/globus_integration_service.rb +++ b/app/services/deepblue/globus_integration_service.rb @@ -50,6 +50,9 @@ def self.setup ::Deepblue::InitializationConstants::PREP ) mattr_accessor :globus_restart_all_copy_jobs_quiet, default: true + mattr_accessor :globus_default_generate_error_on_copy, default: false + mattr_accessor :globus_default_delay_per_file_seconds_on_copy, default: 0 + def self.globus_int_srv() puts "globus_int_srv" end diff --git a/app/services/deepblue/globus_service.rb b/app/services/deepblue/globus_service.rb index 527f6e35..08c0d9d4 100644 --- a/app/services/deepblue/globus_service.rb +++ b/app/services/deepblue/globus_service.rb @@ -10,7 +10,7 @@ def self.get_du( path: ) cmd = "du -sh #{path}" rv = `#{cmd}` rv = Array( rv.chomp.split( "\t" ) ) - rv << 'N/A' if rv.size < 2 + rv.unshift( 'N/A' ) if rv.size < 2 # prepend rv end @@ -133,18 +133,20 @@ def self.globus_locked?( concern_id, log_prefix: '', quiet: true ) def self.globus_prep_dir_du( concern_id: ) dir = globus_target_prep_dir( concern_id ) - return get_du( path: dir ) if File.exist? dir + return get_du( path: dir ).first if File.exist? dir dir = globus_target_prep_dir( concern_id, prefix: nil ) - get_du( path: dir ).first + rv = get_du( path: dir ).first # get_du2( paths: [globus_target_prep_dir( concern_id ), globus_target_prep_dir( concern_id, prefix: nil )] ) + rv end def self.globus_prep_tmp_dir_du( concern_id: ) dir = globus_target_prep_tmp_dir( concern_id ) - return get_du( path: dir ) if File.exist? dir + return get_du( path: dir ).first if File.exist? dir dir = globus_target_prep_tmp_dir( concern_id, prefix: nil ) - get_du( path: dir ).first + rv = get_du( path: dir ).first # get_du2( paths: [globus_target_prep_tmp_dir( concern_id ), globus_target_prep_tmp_dir( concern_id, prefix: nil )] ) + rv end def self.globus_read_token( token_file ) diff --git a/config/initializers/globus_service_integration.rb b/config/initializers/globus_service_integration.rb index eed683a4..dae543cf 100644 --- a/config/initializers/globus_service_integration.rb +++ b/config/initializers/globus_service_integration.rb @@ -90,6 +90,9 @@ config.globus_dashboard_display_report = false # config.globus_debug_delay_per_file_copy_job_seconds = 30 config.globus_dashboard_controller_debug_verbose = false + + config.globus_default_generate_error_on_copy = false + config.globus_default_delay_per_file_seconds_on_copy = 0 else config.globus_dashboard_display_all_works = false config.globus_dashboard_display_report = false