<commit_before># Job to handle kicking off a Deployment request
class DeploymentReaperJob < ApplicationJob
  queue_as :default

  def build_url(app_id, build_id)
    "https://dashboard.heroku.com/apps/#{app_id}/activity/builds/#{build_id}"
  end

  # rubocop:disable Metrics/AbcSize
  # rubocop:disable Metrics/MethodLength
  def perform(*args_list)
    args = args_list.first

    sha            = args.fetch(:sha)
    repo           = args.fetch(:repo)
    name           = args.fetch(:name)
    app_id         = args.fetch(:app_id)
    build_id       = args.fetch(:build_id)
    command_id     = args.fetch(:command_id)
    deployment_url = args.fetch(:deployment_url)

    command  = Command.find(command_id)
    pipeline = command.handler.pipelines[name]

    info = pipeline.reap_build(app_id, build_id)
    if info
      artifact = { sha: sha, slug: info["slug"]["id"], repo: repo }
      Rails.logger.info "Build Complete: #{artifact.to_json}"

      payload = {
        state: "failure",
        target_url:  build_url(app_id, build_id),
        description: "Chat deployment complete. slash-heroku"
      }
      payload[:state] = "success" if info["status"] == "succeeded"

      pipeline.create_deployment_status(deployment_url, payload)
    elsif command.created_at > 2.minutes.ago
      DeploymentReaperJob.set(wait: 10.seconds).perform_later(args)
    else
      Rails.logger.info "Build expired for command: #{command.id}"
      payload = {
        state: "failure",
        target_url:  build_url(app_id, build_id),
        description: "Heroku build took longer than 5 minutes."
      }
      pipeline.create_deployment_status(deployment_url, payload)
    end
  rescue StandardError => e
    Rails.logger.info e.inspect
    Rails.logger.info "ArgList: #{args_list.inspect}"
  end
  # rubocop:enable Metrics/AbcSize
  # rubocop:enable Metrics/MethodLength
end
<commit_msg>use 15 minute max timeout for build jobs<commit_after># Job to handle kicking off a Deployment request
class DeploymentReaperJob < ApplicationJob
  queue_as :default

  def build_url(app_id, build_id)
    "https://dashboard.heroku.com/apps/#{app_id}/activity/builds/#{build_id}"
  end

  # rubocop:disable Metrics/AbcSize
  # rubocop:disable Metrics/MethodLength
  def perform(*args_list)
    args = args_list.first

    sha            = args.fetch(:sha)
    repo           = args.fetch(:repo)
    name           = args.fetch(:name)
    app_id         = args.fetch(:app_id)
    build_id       = args.fetch(:build_id)
    command_id     = args.fetch(:command_id)
    deployment_url = args.fetch(:deployment_url)

    command  = Command.find(command_id)
    pipeline = command.handler.pipelines[name]

    info = pipeline.reap_build(app_id, build_id)
    if info
      artifact = { sha: sha, slug: info["slug"]["id"], repo: repo }
      Rails.logger.info "Build Complete: #{artifact.to_json}"

      payload = {
        state: "failure",
        target_url:  build_url(app_id, build_id),
        description: "Chat deployment complete. slash-heroku"
      }
      payload[:state] = "success" if info["status"] == "succeeded"

      pipeline.create_deployment_status(deployment_url, payload)
    elsif command.created_at > 15.minutes.ago
      DeploymentReaperJob.set(wait: 10.seconds).perform_later(args)
    else
      Rails.logger.info "Build expired for command: #{command.id}"
      payload = {
        state: "failure",
        target_url:  build_url(app_id, build_id),
        description: "Heroku build took longer than 5 minutes."
      }
      pipeline.create_deployment_status(deployment_url, payload)
    end
  rescue StandardError => e
    Rails.logger.info e.inspect
    Rails.logger.info "ArgList: #{args_list.inspect}"
  end
  # rubocop:enable Metrics/AbcSize
  # rubocop:enable Metrics/MethodLength
end

{'fraction_non_alphanumeric': 0.1093011035207567, 'fraction_numerical': 0.002890173410404624, 'mean_word_length': 3.0673076923076925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4114761', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1215, 'n_words': 251}