<commit_before># vim:fileencoding=utf-8

require 'dbee/request'
require 'facter'

module DBEE
  class Enqueuer
    attr_accessor :request_id, :http, :input, :material

    def initialize(input)
      proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || nil
      @input = input
      # ダウンロードジョブの関係上、任意の場所に置いたまま処理はできないので
      # MATERIAL_DIR以下にない場合はシンボリックリンクを張る
      @material = Pathname.new("#{DBEE::Config::MATERIAL_DIR}/#{input.basename}")
      unless File.exist?(material)
        @material.symlink(input)
      end
    end

    def get_request_json
      # request api用にJSONを生成する
      {
        "requester"     => Facter.value(:fqdn),
        "material_node" => Facter.value(:fqdn),
        "run_list" => [
          {
            "name" => "DBEE::Job::Download",
            "args" => {
              "base_url" => DBEE::Config::MATERIAL_BASE_URL
            }
          },
          {
            "name" => "DBEE::Job::Encode::IPAD",
            "args" => {
              "file"   => @input,
              "worker" => Facter.value(:fqdn)
            }
          },
          {
            "name" => "DBEE::Job::Upload::DAV",
            "args" => {}
          },
          {
            "name" => "DBEE::Job::Notification",
            "args" => {
              "to" => "<EMAIL>"
            }<commit_msg>enqueuer: Fix syntax error<commit_after># vim:fileencoding=utf-8

require 'dbee/request'
require 'facter'

module DBEE
  class Enqueuer
    attr_accessor :request_id, :http, :input, :material

    def initialize(input)
      proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || nil
      @input = input
      # ダウンロードジョブの関係上、任意の場所に置いたまま処理はできないので
      # MATERIAL_DIR以下にない場合はシンボリックリンクを張る
      @material = Pathname.new("#{DBEE::Config::MATERIAL_DIR}/#{input.basename}")
      unless File.exist?(material)
        File.symlink(input, @material)
      end
    end

    def get_request_json
      # request api用にJSONを生成する
      {
        "requester"     => Facter.value(:fqdn),
        "material_node" => Facter.value(:fqdn),
        "run_list" => [
          {
            "name" => "DBEE::Job::Download",
            "args" => {
              "base_url" => DBEE::Config::MATERIAL_BASE_URL
            }
          },
          {
            "name" => "DBEE::Job::Encode::IPAD",
            "args" => {
              "file"   => @input,
              "worker" => Facter.value(:fqdn)
            }
          },
          {
            "name" => "DBEE::Job::Upload::DAV",
            "args" => {}
          },
          {
            "name" => "DBEE::Job::Notification",
            "args" => {
              "to" => "<EMAIL>"
            }
{'fraction_non_alphanumeric': 0.1543700340522134, 'fraction_numerical': 0.0007567158531971245, 'mean_word_length': 1.734229576008273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2317014', 'n_tokens_mistral': 937, 'n_tokens_neox': 923, 'n_words': 126}