Skip to content

Commit

Permalink
Merge branch 'main' into qa-run
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Mar 11, 2024
2 parents ec9240b + a5521c6 commit 046af50
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 108 deletions.
175 changes: 89 additions & 86 deletions ansible/Pipfile.lock

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

7 changes: 7 additions & 0 deletions backend/btrixcloud/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ async def inc_crawl_exec_time(
},
)

async def get_crawl_exec_last_update_time(self, crawl_id):
"""get crawl last updated time"""
res = await self.crawls.find_one(
{"_id": crawl_id, "type": "crawl"}, projection=["_lut"]
)
return res and res.get("_lut")

async def get_crawl_state(self, crawl_id: str, is_qa: bool):
"""return current crawl state of a crawl"""
prefix = "" if not is_qa else "qa."
Expand Down
24 changes: 10 additions & 14 deletions backend/btrixcloud/operator/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ async def sync_crawls(self, data: MCSyncData):

else:
status.scale = crawl.scale
status.lastUpdatedTime = to_k8s_date(dt_now())
now = dt_now()
await self.crawl_ops.inc_crawl_exec_time(crawl.db_crawl_id, crawl.is_qa, 0, now)
status.lastUpdatedTime = to_k8s_date(now)

children = self._load_redis(params, status, data.children)

Expand Down Expand Up @@ -863,12 +865,15 @@ async def increment_pod_exec_time(
"""inc exec time tracking"""
now = dt_now()

if not status.lastUpdatedTime:
update_start_time = await self.crawl_ops.get_crawl_exec_last_update_time(
crawl.db_crawl_id
)

if not update_start_time:
await self.crawl_ops.inc_crawl_exec_time(crawl.db_crawl_id, crawl.is_qa, 0, now)
status.lastUpdatedTime = to_k8s_date(now)
return

update_start_time = from_k8s_date(status.lastUpdatedTime)

reason = None
update_duration = (now - update_start_time).total_seconds()

Expand Down Expand Up @@ -942,16 +947,6 @@ async def increment_pod_exec_time(
max_duration = max(duration, max_duration)

if exec_time:
if not await self.crawl_ops.inc_crawl_exec_time(
crawl.db_crawl_id, crawl.is_qa, exec_time, status.lastUpdatedTime
):
# if lastUpdatedTime is same as previous, something is wrong, don't update!
print(
"Already updated for lastUpdatedTime, skipping execTime update!",
flush=True,
)
return

await self.org_ops.inc_org_time_stats(crawl.oid, exec_time, True)
status.crawlExecTime += exec_time
status.elapsedCrawlTime += max_duration
Expand All @@ -961,6 +956,7 @@ async def increment_pod_exec_time(
flush=True,
)

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

def should_mark_waiting(self, state, started):
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/components/ui/copy-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export class CopyButton extends LitElement {
? this.content
: msg("Copy")}
?hoist=${this.hoist}
@sl-hide=${this.stopProp}
@sl-after-hide=${this.stopProp}
>
<sl-icon-button
name=${this.isCopied ? "check-lg" : this.name ? this.name : "files"}
Expand All @@ -82,4 +84,13 @@ export class CopyButton extends LitElement {
button?.blur(); // Remove focus from the button to set it back to its default state
}, 3000);
}

/**
* Stop propgation of sl-tooltip events.
* Prevents bug where sl-dialog closes when tooltip closes
* https://github.com/shoelace-style/shoelace/issues/170
*/
private stopProp(e: Event) {
e.stopPropagation();
}
}
1 change: 1 addition & 0 deletions frontend/src/components/ui/tab-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { property, queryAsync, customElement } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";

const DEFAULT_PANEL_ID = "default-panel";
// postcss-lit-disable-next-line
export const TWO_COL_SCREEN_MIN_CSS = css`64.5rem`;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ export class CrawlPendingExclusions extends LiteElement {
render() {
return html`
<btrix-section-heading style="--margin: var(--sl-spacing-small)">
<div class="flex items-center justify-between">
<div class="flex w-full items-center justify-between">
<div>${msg("Pending Exclusions")} ${this.renderBadge()}</div>
${this.total && this.total > this.pageSize
? html`<btrix-pagination
page=${this.page}
size=${this.pageSize}
totalCount=${this.total}
compact
Expand Down
Loading

0 comments on commit 046af50

Please sign in to comment.