Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions backend/btrixcloud/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,19 +723,31 @@ async def inc_crawl_exec_time(
crawl_id: str,
is_qa: bool,
exec_time: int,
elapsed_time: int,
last_updated_time: datetime,
) -> bool:
) -> tuple[int, int]:
"""increment exec time"""
# update both crawl-shared qa exec seconds and per-qa run exec seconds
if is_qa:

field = "_lut"

# nop if times are 0
if elapsed_time <= 0 and exec_time <= 0:
inc_update = {}

elif is_qa:
inc_update = {
"qaCrawlExecSeconds": exec_time,
"qa.crawlExecSeconds": exec_time,
"qaCrawlElapsedSeconds": exec_time,
"qa.crawlElapsedSeconds": exec_time,
}
field = "qa._lut"
else:
inc_update = {"crawlExecSeconds": exec_time}
field = "_lut"
inc_update = {
"crawlExecSeconds": exec_time,
"crawlElapsedSeconds": elapsed_time,
}

res = await self.crawls.find_one_and_update(
{
Expand All @@ -748,7 +760,16 @@ async def inc_crawl_exec_time(
"$set": {field: last_updated_time},
},
)
return res is not None
if not res:
return 0, 0
Comment thread
tw4l marked this conversation as resolved.

exec_seconds = res.get(
"crawlExecSeconds" if not is_qa else "qaCrawlExecSeconds"
)
elapsed_seconds = res.get(
"crawlElapsedSeconds" if not is_qa else "qaCrawlElapsedSeconds"
)
return exec_seconds, elapsed_seconds

async def get_crawl_exec_last_update_time(
self, crawl_id: str, is_qa: bool
Expand Down
4 changes: 4 additions & 0 deletions backend/btrixcloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ class CoreCrawlable(BaseModel):
state: str

crawlExecSeconds: int = 0
crawlElapsedSeconds: int = 0

image: str | None = None

Expand Down Expand Up @@ -1036,6 +1037,8 @@ class CrawlOut(BaseMongoModel):

crawlExecSeconds: int = 0
qaCrawlExecSeconds: int = 0
crawlElapsedSeconds: int = 0
qaCrawlElapsedSeconds: int = 0

# automated crawl fields
config: RawCrawlConfig | None = None
Expand Down Expand Up @@ -1181,6 +1184,7 @@ class QARunOut(BaseModel):
state: str

crawlExecSeconds: int = 0
crawlElapsedSeconds: int = 0

stats: CrawlStats = CrawlStats()

Expand Down
16 changes: 9 additions & 7 deletions backend/btrixcloud/operator/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ async def increment_pod_exec_time(
)

await self.crawl_ops.inc_crawl_exec_time(
crawl.db_crawl_id, crawl.is_qa, 0, now
crawl.db_crawl_id, crawl.is_qa, 0, 0, now
)
status.lastUpdatedTime = date_to_str(now)
return
Expand Down Expand Up @@ -1521,12 +1521,17 @@ async def increment_pod_exec_time(
exec_time += duration
max_duration = max(duration, max_duration)

if exec_time:
if exec_time > 0:
await self.org_ops.inc_org_time_stats(
crawl.oid, exec_time, True, crawl.is_qa
)
status.crawlExecTime += exec_time
status.elapsedCrawlTime += max_duration

newExecTime, newElapsedTime = await self.crawl_ops.inc_crawl_exec_time(
crawl.db_crawl_id, crawl.is_qa, exec_time, max_duration, now
)

status.crawlExecTime = max(newExecTime, status.crawlExecTime)
status.elapsedCrawlTime = max(newElapsedTime, status.elapsedCrawlTime)

logger.debug(
"pod_exec_time_total_computed",
Expand All @@ -1538,9 +1543,6 @@ async def increment_pod_exec_time(
),
)

await self.crawl_ops.inc_crawl_exec_time(
crawl.db_crawl_id, crawl.is_qa, exec_time, now
)
status.lastUpdatedTime = date_to_str(now)

def should_mark_waiting(self, state: TYPE_ALL_CRAWL_STATES, started: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion backend/btrixcloud/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import os

__version__ = "1.25.0"
__version__ = "1.25.1"
__commit_hash__ = os.environ.get("GIT_COMMIT_HASH")
__branch__ = os.environ.get("GIT_BRANCH_NAME")
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "backend"
version = "1.25.0"
version = "1.25.1"
description = "Browsertrix backend"
requires-python = ">=3.12"
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion backend/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type: application
icon: https://webrecorder.net/assets/icon.png

# Browsertrix and Chart Version
version: v1.25.0
version: v1.25.1

dependencies:
- name: btrix-admin-logging
Expand Down
6 changes: 3 additions & 3 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ replica_deletion_delay_days: 0

# API Image
# =========================================
backend_image: "docker.io/webrecorder/browsertrix-backend:1.25.0"
backend_image: "docker.io/webrecorder/browsertrix-backend:1.25.1"
backend_pull_policy: "IfNotPresent"

backend_password_secret: "PASSWORD!"
Expand Down Expand Up @@ -194,7 +194,7 @@ stuck_uploads_cron_schedule: "0 * * * *"

# Emails Image
# =========================================
emails_image: "docker.io/webrecorder/browsertrix-emails:1.25.0"
emails_image: "docker.io/webrecorder/browsertrix-emails:1.25.1"
emails_pull_policy: "IfNotPresent"

emails_cpu: "10m"
Expand All @@ -208,7 +208,7 @@ local_emails_port: 30872

# Nginx Image
# =========================================
frontend_image: "docker.io/webrecorder/browsertrix-frontend:1.25.0"
frontend_image: "docker.io/webrecorder/browsertrix-frontend:1.25.1"
frontend_pull_policy: "IfNotPresent"

frontend_cpu: "10m"
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browsertrix-frontend",
"version": "1.25.0",
"version": "1.25.1",
"main": "index.ts",
"license": "AGPL-3.0-or-later",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.25.0
1.25.1
Loading