Skip to content

Commit

Permalink
QA: Count QA execution minutes separately for now (#2011)
Browse files Browse the repository at this point in the history
For now, keep QA exec time separate, as it may be scaled differently and currently still in beta.
  • Loading branch information
ikreymer authored Aug 9, 2024
1 parent 4ec7cf8 commit 12f994b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions backend/btrixcloud/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,15 +774,19 @@ async def inc_org_time_stats(
If is_qa is true, also update seperate qa only counter
"""
# pylint: disable=too-many-return-statements, too-many-locals
key = "crawlExecSeconds" if is_exec_time else "usage"
yymm = dt_now().strftime("%Y-%m")
inc_query = {f"{key}.{yymm}": duration}
if is_qa:
inc_query = {}

if not is_qa:
key = "crawlExecSeconds" if is_exec_time else "usage"
inc_query[f"{key}.{yymm}"] = duration
else:
qa_key = "qaCrawlExecSeconds" if is_exec_time else "qaUsage"
inc_query[f"{qa_key}.{yymm}"] = duration

await self.orgs.find_one_and_update({"_id": oid}, {"$inc": inc_query})

if not is_exec_time:
if not is_exec_time or is_qa:
return

org = await self.get_org_by_id(oid)
Expand Down

0 comments on commit 12f994b

Please sign in to comment.