<commit_before>require 'shipitron'

module Shipitron
  class S3Copy
    include Metaractor

    required :source
    required :destination
    required :region

    def call
      if ENV['FOG_LOCAL']
        Logger.info `cp #{source.gsub('s3://', '/fog/')} #{destination.gsub('s3://', '/fog/')}`
        if $? != 0
          fail_with_error!(message: 'Failed to transfer to/from s3 (mocked).')
        end
      else
        Logger.info `docker run --rm -t -v shipitron-home:/home/shipitron amazon/aws-cli:latest --region #{region} s3 cp #{source} #{destination}`
        if $? != 0
          fail_with_error!(message: 'Failed to transfer to/from s3.')
        end
      end
    end

    private
    def source
      context.source
    end

    def destination
      context.destination
    end

    def region
      context.region
    end
  end
end<commit_msg>Send AWS_CONTAINER_CREDENTIALS_RELATIVE_URI env var to aws cli<commit_after>require 'shipitron'

module Shipitron
  class S3Copy
    include Metaractor

    required :source
    required :destination
    required :region

    def call
      if ENV['FOG_LOCAL']
        Logger.info `cp #{source.gsub('s3://', '/fog/')} #{destination.gsub('s3://', '/fog/')}`
        if $? != 0
          fail_with_error!(message: 'Failed to transfer to/from s3 (mocked).')
        end
      else
        Logger.info `docker run --rm -t -v shipitron-home:/home/shipitron -e AWS_CONTAINER_CREDENTIALS_RELATIVE_URI amazon/aws-cli:latest --region #{region} s3 cp #{source} #{destination}`
        if $? != 0
          fail_with_error!(message: 'Failed to transfer to/from s3.')
        end
      end
    end

    private
    def source
      context.source
    end

    def destination
      context.destination
    end

    def region
      context.region
    end
  end
end
{'fraction_non_alphanumeric': 0.11196911196911197, 'fraction_numerical': 0.00882515168229454, 'mean_word_length': 2.25089605734767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1746317', 'n_tokens_mistral': 593, 'n_tokens_neox': 573, 'n_words': 157}