Skip to content

Commit

Permalink
for idaholab#446, allow specifying OPENSEARCH_INDEX_SIZE_PRUNE_LIMIT …
Browse files Browse the repository at this point in the history
…for other database modes
  • Loading branch information
mmguero committed Sep 16, 2024
1 parent f9067e5 commit 87086cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
17 changes: 5 additions & 12 deletions scripts/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,7 @@ def tweak_malcolm_runtime(self, malcolm_install_path):
diskUsageManagementPrompt = InstallerYesOrNo(
(
'Should Malcolm delete the oldest database indices and capture artifacts based on available storage?'
if (
(opensearchPrimaryMode == DatabaseMode.OpenSearchLocal)
and (malcolmProfile == PROFILE_MALCOLM)
)
if (malcolmProfile == PROFILE_MALCOLM)
else 'Should Malcolm delete the oldest capture artifacts based on available storage?'
),
default=args.arkimeManagePCAP
Expand All @@ -1384,14 +1381,10 @@ def tweak_malcolm_runtime(self, malcolm_install_path):
if diskUsageManagementPrompt:

# delete oldest indexes based on index pattern size
if (
(malcolmProfile == PROFILE_MALCOLM)
and (opensearchPrimaryMode == DatabaseMode.OpenSearchLocal)
and InstallerYesOrNo(
'Delete the oldest indices when the database exceeds a certain size?',
default=bool(args.indexPruneSizeLimit),
extraLabel=BACK_LABEL,
)
if (malcolmProfile == PROFILE_MALCOLM) and InstallerYesOrNo(
'Delete the oldest indices when the database exceeds a certain size?',
default=bool(args.indexPruneSizeLimit),
extraLabel=BACK_LABEL,
):
indexPruneSizeLimit = ''
loopBreaker = CountUntilException(MaxAskForValueCount, 'Invalid index threshold')
Expand Down
8 changes: 5 additions & 3 deletions shared/bin/opensearch_index_size_prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ def main():
if ('node' in stat) and (stat['node'] != 'UNASSIGNED'):
esDiskUsageStats.append(
{
key: humanfriendly.parse_size(value)
if re.match(r'^\d+(\.\d+)?\s*[kmgtp]?b$', value, flags=re.IGNORECASE)
else value
key: (
humanfriendly.parse_size(value)
if re.match(r'^\d+(\.\d+)?\s*[kmgtp]?b$', value, flags=re.IGNORECASE)
else value
)
for (key, value) in stat.items()
}
)
Expand Down

0 comments on commit 87086cd

Please sign in to comment.