Search Engine: Elastic

Article ID: 130510, created on Mar 24, 2017, last review on Jul 14, 2018

  • Applies to:
  • Operations Automation 6.0


APS resources for brands were duplicated in Odin Automation 6.0 due to bug #APS-37738. The bug was fixed as described in KB130323 for Odin Automation 6.0.9. However, while the solution from KB130323 prevents the appearance of new redundant resources, it does not remove the old ones. Hence, this bug was filed: #APS-41094.


To remove the unneeded resources, download and run this script on OA Operations MN. The script will remove duplicated brands APS resources and therefore will improve the performance of the 'update account info' action.

The script does not require to stop pem or pau services however it executes some SQL queries which theoretically can interfere with the database queries produced by the normal activity of the system. Thus, we strictly recommend to run this script in business calm time to eliminated such an interferential.

Script Usage

Script should be called on MN.

The script provides the following options:


Specifying this option, we just ask to check the consistency of relationships between account APS resource and their brands APS resources. In this case script tries to find inconsistencies and types the brief report about current state of such a relationships. It could look like the following:

Fail: duplicate APS resources for brands are found:
  Brand #20 - 11828 resources
  Brand #5 - 2367 resources
  Brand #11 - 198 resources
  Brand #2 - 64651 resources

which means the system has the original inconsistency between accounts and brands APS resources.

If the inconsistencies are not detected, the script just types this:

 Verifying brand APS resources...OK. Duplicate APS resources for brands are not found

In such a case, there is no reason to run script to fix the issue as the inconsistencies we are looking for does not exist.


  python --check


To estimate how much time the script would take to fix the issues or to play the emulation of that work, there is special option has been implemented. Option tells the script to perform all work for fixing original issue but does not commit the changes done. Instead, script performs rollback of its transaction, which guarantees that fixing changes are not actualized and PA database keeps original state.


  time python --dry-run


This is the main option the script is aimed for. Option tells the script to find all inconsistencies between accounts and brands APS resources and fix all corresponding errors. This option tells the script to do absolutely the same as --dry-run does but in this case script commits its transaction and fixing changes are actualized.


  python --fix


This option tells the script to type more details information to console


  python --dry-run --verbose


This option tells the script to type its usage information.


  python --help

#- INTERNAL (content below this line is not visible in published article)

5356b422f65bdad1c3e9edca5d74a1ae caea8340e2d186a540518d08602aa065 e12cea1d47a3125d335d68e6d4e15e07 956c448bddc7e1f3585373687602379f 6f1456866eed87488c0f02b298a741c0

Email subscription for changes to this article
Save as PDF