Maintenance::AgentPortDataTask

Source code
# frozen_string_literal: true

# This class handles the import of agent port data for the maintenance module.
# Processes CSV rows to update agent port information in the database.

class Maintenance::AgentPortDataTask < MaintenanceTasks::Task
  include DatadogTrace

  csv_collection
  HEADER_MBO_ID = 'MBO_ID'
  HEADER_COMPANY_GUID = 'COMPANY_GUID'

  report_on(StandardError)

  def process(row)
    mbo_id, company_guid = extract_ids(row)
    tree_node = with_trace { find_tree_node(mbo_id) }
    return unless tree_node

    update_tree_node(tree_node, mbo_id, company_guid)
  end

  private

  def update_tree_node(tree_node, mbo_id, company_guid)
    with_trace(tags: { mbo_id:, company_guid: }) do
      tree_node.update!(company_guid:)
    end
  end

  def find_tree_node(mbo_id)
    TreeNode.joins(:mbo_profiles).find_sole_by(mbo_profiles: { mbo_id: })
  end

  def extract_ids(row)
    row.to_h.fetch_values(HEADER_MBO_ID, HEADER_COMPANY_GUID)
  end
end

Active Runs

Enqueued
#62

Waiting to start.

Enqueued
#61

Waiting to start.

Enqueued
#60

Waiting to start.

Enqueued
#59

Waiting to start.

Cancelling
#58

Cancelling…

Cancelling
#57

Cancelling…


Previous Runs

Succeeded
#67

Processed 2,849 out of 2,849 items (100%).

Ran for 1 minute, finished .


Succeeded
#66

Processed 4 out of 4 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#65

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#64

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#63

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Errored
#55

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#53

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#52

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Cancelled
#51

Ran for less than 5 seconds, cancelled .

Succeeded
#49

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#47

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#46

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#45

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Succeeded
#44

Processed 48 out of 48 items (100%).

Ran for less than 5 seconds, finished .

Errored
#43

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#42

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#41

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#40

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#39

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Errored
#38

Processed 0 items.

Ran for less than 5 seconds until an error happened .

ActiveStorage::FileNotFoundError

ActiveStorage::FileNotFoundError

Next page