mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 16:01:42 +00:00
fix: improve display result output limit
This commit is contained in:
@@ -592,7 +592,7 @@ fn generate_get_job_query(no_logs: bool, table: &str) -> String {
|
||||
deleted,
|
||||
is_skipped,
|
||||
result->'wm_labels' as labels,
|
||||
CASE WHEN result is null or pg_column_size(result) < 2000000 THEN result ELSE '\"WINDMILL_TOO_BIG\"'::jsonb END as result"
|
||||
CASE WHEN result is null or pg_column_size(result) < 90000 THEN result ELSE '\"WINDMILL_TOO_BIG\"'::jsonb END as result"
|
||||
} else {
|
||||
"scheduled_for,
|
||||
running,
|
||||
@@ -614,7 +614,7 @@ fn generate_get_job_query(no_logs: bool, table: &str) -> String {
|
||||
};
|
||||
return format!("SELECT
|
||||
id, {table}.workspace_id, parent_job, created_by, {table}.created_at, started_at, script_hash, script_path,
|
||||
CASE WHEN args is null or pg_column_size(args) < 2000000 THEN args ELSE '{{\"reason\": \"WINDMILL_TOO_BIG\"}}'::jsonb END as args,
|
||||
CASE WHEN args is null or pg_column_size(args) < 90000 THEN args ELSE '{{\"reason\": \"WINDMILL_TOO_BIG\"}}'::jsonb END as args,
|
||||
{log_expr} as logs, raw_code, canceled, canceled_by, canceled_reason, job_kind, env_id,
|
||||
schedule_path, permissioned_as, flow_status, raw_flow, is_flow_step, language,
|
||||
raw_lock, email, visible_to_owner, mem_peak, tag, priority, {additional_fields}
|
||||
@@ -4018,7 +4018,7 @@ async fn get_completed_job<'a>(
|
||||
Path((w_id, id)): Path<(String, Uuid)>,
|
||||
) -> error::Result<Response> {
|
||||
let job_o = sqlx::query("SELECT id, workspace_id, parent_job, created_by, created_at, duration_ms, success, script_hash, script_path,
|
||||
CASE WHEN args is null or pg_column_size(args) < 2000000 THEN args ELSE '\"WINDMILL_TOO_BIG\"'::jsonb END as args, CASE WHEN result is null or pg_column_size(result) < 2000000 THEN result ELSE '\"WINDMILL_TOO_BIG\"'::jsonb END as result, logs, deleted, raw_code, canceled, canceled_by, canceled_reason, job_kind, env_id,
|
||||
CASE WHEN args is null or pg_column_size(args) < 90000 THEN args ELSE '\"WINDMILL_TOO_BIG\"'::jsonb END as args, CASE WHEN result is null or pg_column_size(result) < 90000 THEN result ELSE '\"WINDMILL_TOO_BIG\"'::jsonb END as result, logs, deleted, raw_code, canceled, canceled_by, canceled_reason, job_kind, env_id,
|
||||
schedule_path, permissioned_as, flow_status, raw_flow, is_flow_step, language, started_at, is_skipped,
|
||||
raw_lock, email, visible_to_owner, mem_peak, tag, priority, result->'wm_labels' as labels FROM completed_job WHERE id = $1 AND workspace_id = $2")
|
||||
.bind(id)
|
||||
|
||||
@@ -1863,7 +1863,7 @@ async fn pull_single_job_and_mark_as_running_no_concurrency_limit<
|
||||
, suspend_until = null
|
||||
WHERE id = $1
|
||||
RETURNING id, workspace_id, parent_job, created_by, created_at, started_at, scheduled_for,
|
||||
running, script_hash, script_path, args, right(logs, 20000000) as logs, raw_code, canceled, canceled_by,
|
||||
running, script_hash, script_path, args, right(logs, 900000) as logs, raw_code, canceled, canceled_by,
|
||||
canceled_reason, last_ping, job_kind, env_id, schedule_path, permissioned_as,
|
||||
flow_status, raw_flow, is_flow_step, language, suspend, suspend_until,
|
||||
same_worker, raw_lock, pre_run_error, email, visible_to_owner, mem_peak,
|
||||
|
||||
@@ -97,25 +97,65 @@
|
||||
keys.length == 1 && keys.includes('render_all') && Array.isArray(result['render_all'])
|
||||
|
||||
// Check if the result is an image
|
||||
if (['png', 'svg', 'jpeg', 'html', 'gif'].includes(keys[0]) && keys.length == 1) {
|
||||
if (
|
||||
[
|
||||
'png',
|
||||
'svg',
|
||||
'jpeg',
|
||||
'html',
|
||||
'gif',
|
||||
'table-row',
|
||||
'table-col',
|
||||
'table-row-object'
|
||||
].includes(keys[0]) &&
|
||||
keys.length == 1
|
||||
) {
|
||||
// Check if the image is too large (10mb)
|
||||
largeObject = roughSizeOfObject(result) > 10000000
|
||||
|
||||
return keys[0] as 'png' | 'svg' | 'jpeg' | 'html' | 'gif'
|
||||
return keys[0] as
|
||||
| 'png'
|
||||
| 'svg'
|
||||
| 'jpeg'
|
||||
| 'html'
|
||||
| 'gif'
|
||||
| 'table-row'
|
||||
| 'table-col'
|
||||
| 'table-row-object'
|
||||
}
|
||||
|
||||
if (Array.isArray(result)) {
|
||||
largeObject = roughSizeOfObject(result) > 5000000
|
||||
|
||||
if (largeObject) {
|
||||
return 'json'
|
||||
} else if (result.every((elt) => inferResultKind(elt) === 's3object')) {
|
||||
largeObject = result.length > 100
|
||||
if (largeObject) {
|
||||
return 'json'
|
||||
}
|
||||
return 's3object-list'
|
||||
} else if (isArrayOfArrays(result)) {
|
||||
return 'table-row'
|
||||
} else if (isObjectOfArrays(result, keys)) {
|
||||
return 'table-col'
|
||||
} else if (isArrayOfObjects(result)) {
|
||||
return 'table-row-object'
|
||||
} else {
|
||||
return 'json'
|
||||
}
|
||||
}
|
||||
|
||||
let length = roughSizeOfObject(result)
|
||||
// Otherwise, check if the result is too large (10kb) for json
|
||||
largeObject = length > 50000
|
||||
largeObject = length > 100000
|
||||
|
||||
if (largeObject) {
|
||||
return 'json'
|
||||
}
|
||||
|
||||
if (keys.length != 0) {
|
||||
if (Array.isArray(result) && result.every((elt) => inferResultKind(elt) === 's3object')) {
|
||||
return 's3object-list'
|
||||
} else if (keys.length == 1 && keys[0] == 'table-row') {
|
||||
if (keys.length == 1 && keys[0] == 'table-row') {
|
||||
return 'table-row'
|
||||
} else if (keys.length == 1 && keys[0] == 'table-col') {
|
||||
return 'table-col'
|
||||
@@ -160,12 +200,6 @@
|
||||
return 's3object'
|
||||
} else if (keys.length === 1 && (keys.includes('md') || keys.includes('markdown'))) {
|
||||
return 'markdown'
|
||||
} else if (isArrayOfArrays(result)) {
|
||||
return 'table-row'
|
||||
} else if (isObjectOfArrays(result, keys)) {
|
||||
return 'table-col'
|
||||
} else if (isArrayOfObjects(result)) {
|
||||
return 'table-row-object'
|
||||
}
|
||||
}
|
||||
} catch (err) {}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
workspace: $workspaceStore!
|
||||
})
|
||||
if (!emptyString(defaultApp.default_app_path)) {
|
||||
goto(`/apps/get/${defaultApp.default_app_path}`)
|
||||
await goto(`/apps/get/${defaultApp.default_app_path}`)
|
||||
} else {
|
||||
await goto(rd ?? '/')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user