Skip to content

Commit

Permalink
Merge pull request #1479 from mlibrary/DEEPBLUE-285-send-works-to-apt…
Browse files Browse the repository at this point in the history
…rust-10

DEEPBLUE-285 - Send works to APTrust - 10
  • Loading branch information
blancoj authored Dec 20, 2023
2 parents 832cef6 + 64e8745 commit 49624a3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/jobs/aptrust_upload_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AptrustUploadJob < AbstractRakeTaskJob
#filter_min_total_size: 1
#filter_max_total_size: 1000000 # 1 million bytes
#filter_max_total_size: 1000000000 # 1 billion bytes
filter_ignore_status: false
#filter_ignore_status: true # i.e. reupload
xfilter_skip_statuses: # see: ::Aptrust::FilterStatus::SKIP_STATUSES
- uploaded
- verified
Expand Down Expand Up @@ -74,6 +74,7 @@ def perform( *args )
"" ] if aptrust_upload_job_debug_verbose
::Deepblue::SchedulerHelper.log( class_name: self.class.name )
return unless initialized
return job_finished unless by_request_only? && from_dashboard.present?
debug_verbose = job_options_value( key: 'debug_verbose', default_value: debug_verbose )
filter_debug_verbose = job_options_value( key: 'filter_debug_verbose', default_value: false )
msg_handler.debug_verbose = debug_verbose
Expand Down
26 changes: 21 additions & 5 deletions app/services/aptrust/aptrust_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ class AptrustUploader
IDENTIFIER_TEMPLATE = '%repository%.%context%%type%%id%' unless const_defined? :IDENTIFIER_TEMPLATE

def self.bag_date_now()
rv = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
rv = Time.parse(rv).iso8601
return rv
return Time.now
# rv = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
# rv = Time.parse(rv).iso8601
# return rv
end

attr_accessor :additional_tag_files
Expand Down Expand Up @@ -166,7 +167,9 @@ def initialize( object_id:,

@bag = bag
@bag_info = bag_info
@bi_date = Aptrust.arg_init_squish( bi_date, AptrustUploader.bag_date_now )
# @bi_date = Aptrust.arg_init_squish( bi_date, AptrustUploader.bag_date_now )
@bi_date = bi_date
@bi_date ||= AptrustUploader.bag_date_now
@bi_description = Aptrust.arg_init_squish( bi_description, DEFAULT_BI_DESCRIPTION )
@bi_id = Aptrust.arg_init_squish( bi_id, @object_id )
@bi_source = Aptrust.arg_init_squish( bi_source, DEFAULT_BI_SOURCE )
Expand Down Expand Up @@ -228,6 +231,18 @@ def bag_data_dir
@bag_data_dir ||= File.join( bag.bag_dir, "data" )
end

def bag_date_str( t )
rv = t.utc.strftime("%Y-%m-%d")
rv = Time.parse(rv).iso8601
return rv
end

def bag_date_time_str( t )
rv = t.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
rv = Time.parse(rv).iso8601
return rv
end

def bag_id_context
@bag_id_context = bag_id_context_init if @bag_id_context.blank?
@bag_id_context
Expand Down Expand Up @@ -278,7 +293,8 @@ def bag_info_init
rv = {
'Source-Organization' => bi_source,
'Bag-Count' => '1',
'Bagging-Date' => bi_date,
'Bagging-Date' => bag_date_str( bi_date ),
'Bagging-Timestamp' => bag_date_time_str( bi_date ),
'Internal-Sender-Description' => bi_description,
'Internal-Sender-Identifier' => bi_id
}
Expand Down

0 comments on commit 49624a3

Please sign in to comment.