clarify run detail page + allow i64 for MAX_LOG_SIZE

This commit is contained in:
Ruben Fiszel
2023-01-13 18:39:17 +01:00
parent 71708b7566
commit b478ba8c45
3 changed files with 50 additions and 46 deletions
+7 -7
View File
@@ -417,7 +417,7 @@ pub async fn run_worker(
let pip_trusted_host = std::env::var("PIP_TRUSTED_HOST").ok();
let max_log_size = std::env::var("MAX_LOG_SIZE")
.ok()
.and_then(|x| x.parse::<i32>().ok())
.and_then(|x| x.parse::<i64>().ok())
.unwrap_or(500000);
#[cfg(feature = "enterprise")]
@@ -739,7 +739,7 @@ struct Envs {
pip_index_url: Option<String>,
pip_extra_index_url: Option<String>,
pip_trusted_host: Option<String>,
max_log_size: i32,
max_log_size: i64,
}
#[tracing::instrument(level = "trace", skip_all)]
@@ -2088,7 +2088,7 @@ async fn install_go_dependencies(
job_dir: &str,
db: &sqlx::Pool<sqlx::Postgres>,
timeout: i32,
max_log_size: i32,
max_log_size: i64,
go_path: &str,
preview: bool,
skip_go_mod: bool,
@@ -2192,7 +2192,7 @@ async fn handle_child(
db: &Pool<Postgres>,
logs: &mut String,
timeout: i32,
max_log_size: i32,
max_log_size: i64,
mut child: Child,
) -> error::Result<()> {
let timeout = Duration::from_secs(u64::try_from(timeout).expect("invalid timeout"));
@@ -2399,9 +2399,9 @@ async fn handle_child(
kill_tx.send(()).expect("send should always work");
match wait_result {
_ if *too_many_logs.borrow() => Err(Error::ExecutionErr(
"logs or result reached limit".to_string(),
)),
_ if *too_many_logs.borrow() => Err(Error::ExecutionErr(format!(
"logs or result reached limit. Set MAX_LOG_SIZE higher (current: {max_log_size})"
))),
Ok(Ok(status)) => {
if status.success() {
Ok(())
@@ -22,6 +22,7 @@
faUser,
faBarsStaggered
} from '@fortawesome/free-solid-svg-icons'
import { CalendarClock } from 'lucide-svelte'
import Icon from 'svelte-awesome'
import { check } from 'svelte-awesome/icons'
import { Badge } from '../common'
@@ -144,41 +145,8 @@
>
</div>
{/if}
<div>
{#if job && job.parent_job}
{#if job.is_flow_step}
<Icon class="text-gray-700" data={faBarsStaggered} scale={SMALL_ICON_SCALE} /><span
class="mx-2"
>
Step of flow <a href={`/run/${job.parent_job}`}>{truncateRev(job.parent_job, 6)}</a
></span
>
{:else}
<Icon class="text-gray-700" data={faRobot} scale={SMALL_ICON_SCALE} /><span
class="mx-2"
>
Triggered by parent <a href={`/run/${job.parent_job}`}>{job.parent_job}</a></span
>
{/if}
{:else if job && job.schedule_path}
<Icon class="text-gray-700" data={faCalendar} scale={SMALL_ICON_SCALE} />
<span class="mx-2"
>Triggered by the schedule: <button
class="break-words text-sm text-blue-600 font-normal"
on:click={() =>
scheduleEditor?.openEdit(job.schedule_path ?? '', job.job_kind == 'flow')}
>{job.schedule_path}</button
></span
>
{/if}
</div>
</div>
<div class="text-gray-500 text-xs text-left place-self-start flex flex-col gap-1">
<div>
<Icon class="text-gray-700" data={faClock} scale={SMALL_ICON_SCALE} /><span class="mx-2">
Created {displayDaysAgo(job.created_at ?? '')}</span
>
</div>
{#if 'started_at' in job && job.started_at}
<div>
<Icon class="text-gray-700" data={faClock} scale={SMALL_ICON_SCALE} /><span
@@ -189,10 +157,9 @@
</div>
{/if}
{#if 'scheduled_for' in job && !job.running && job.scheduled_for && forLater(job.scheduled_for)}
<div>
<Icon class="text-gray-700" data={faCalendar} scale={SMALL_ICON_SCALE} /><span
class="mx-2"
>
<div class="inline-flex gap-1">
<CalendarClock size={13} class="-ml-0.5" />
<span>
<span class="bg-blue-200 text-gray-700 text-xs rounded px-1 ">Scheduled</span>
for {displayDate(job.scheduled_for ?? '')}
</span>
@@ -208,6 +175,34 @@
</span>
</div>
{/if}
<div>
{#if job && job.parent_job}
{#if job.is_flow_step}
<Icon class="text-gray-700" data={faBarsStaggered} scale={SMALL_ICON_SCALE} /><span
class="mx-1"
>
Step of flow <a href={`/run/${job.parent_job}`}>{truncateRev(job.parent_job, 6)}</a
></span
>
{:else}
<Icon class="text-gray-700" data={faRobot} scale={SMALL_ICON_SCALE} /><span
class="mx-1"
>
Parent <a href={`/run/${job.parent_job}`}>{job.parent_job}</a></span
>
{/if}
{:else if job && job.schedule_path}
<Icon class="text-gray-700" data={faCalendar} scale={SMALL_ICON_SCALE} />
<span class="mx-1"
>Schedule <button
class="break-words text-blue-400 font-normal truncate text-xs"
on:click={() =>
scheduleEditor?.openEdit(job.schedule_path ?? '', job.job_kind == 'flow')}
>{job.schedule_path}</button
></span
>
{/if}
</div>
</div>
</div>
</div>
@@ -1,7 +1,14 @@
<script lang="ts">
import { page } from '$app/stores'
import { JobService, Job } from '$lib/gen'
import { canWrite, encodeState, forLater, sendUserToast, truncateHash } from '$lib/utils'
import {
canWrite,
displayDate,
encodeState,
forLater,
sendUserToast,
truncateHash
} from '$lib/utils'
import Icon from 'svelte-awesome'
import { check } from 'svelte-awesome/icons'
import {
@@ -298,7 +305,9 @@
</div>
</div>
{#if job?.job_kind !== 'flow' && job?.job_kind !== 'flowpreview'}
{#if job?.['scheduled_for'] && forLater(job?.['scheduled_for'])}
<h2 class="mt-10">Scheduled to be executed later: {displayDate(job?.['scheduled_for'])}</h2>
{:else if job?.job_kind !== 'flow' && job?.job_kind !== 'flowpreview'}
<!-- Logs and outputs-->
<div class="mr-2 sm:mr-0 mt-12">
<Tabs bind:selected={viewTab}>