11import { column , type TableSchema } from "@internal/tsql" ;
22import { runFriendlyStatus , runStatusTitleFromStatus } from "~/components/runs/v3/TaskRunStatus" ;
3+ import { logger } from "~/services/logger.server" ;
34
45/**
56 * Environment type values
@@ -122,6 +123,7 @@ export const runsSchema: TableSchema = {
122123 customRenderType : "runId" ,
123124 expression : "if(root_run_id = '', NULL, 'run_' || root_run_id)" ,
124125 } ) ,
126+ whereTransform : ( value : string ) => value . replace ( / ^ r u n _ / , "" ) ,
125127 } ,
126128 parent_run_id : {
127129 name : "parent_run_id" ,
@@ -131,6 +133,7 @@ export const runsSchema: TableSchema = {
131133 customRenderType : "runId" ,
132134 expression : "if(parent_run_id = '', NULL, 'run_' || parent_run_id)" ,
133135 } ) ,
136+ whereTransform : ( value : string ) => value . replace ( / ^ r u n _ / , "" ) ,
134137 } ,
135138 depth : {
136139 name : "depth" ,
@@ -226,7 +229,7 @@ export const runsSchema: TableSchema = {
226229 name : "ttl" ,
227230 clickhouseName : "expiration_ttl" ,
228231 ...column ( "String" , {
229- description : "TTL string for expiration. By default dev runs have a TTL of 10m." ,
232+ description : "The TTL string for expiration – by default dev runs have a TTL of ' 10m' ." ,
230233 example : "10m" ,
231234 } ) ,
232235 } ,
@@ -268,7 +271,7 @@ export const runsSchema: TableSchema = {
268271 name : "usage_duration" ,
269272 clickhouseName : "usage_duration_ms" ,
270273 ...column ( "UInt32" , {
271- description : "Usage duration in milliseconds" ,
274+ description : "Compute usage duration in milliseconds. " ,
272275 customRenderType : "duration" ,
273276 example : "3500" ,
274277 } ) ,
@@ -285,7 +288,7 @@ export const runsSchema: TableSchema = {
285288 invocation_cost : {
286289 name : "invocation_cost" ,
287290 ...column ( "Float64" , {
288- description : "Invocation cost in dollars" ,
291+ description : "Invocation cost in dollars – the cost to start a run. " ,
289292 customRenderType : "costInDollars" ,
290293 example : "0.000025" ,
291294 } ) ,
@@ -304,13 +307,17 @@ export const runsSchema: TableSchema = {
304307 // Output & error (JSON columns)
305308 output : {
306309 name : "output" ,
307- ...column ( "JSON" , { description : "Run output data" , example : '{"result": "success"}' } ) ,
310+ ...column ( "JSON" , {
311+ description : "The data you returned from the task." ,
312+ example : '{"result": "success"}' ,
313+ } ) ,
308314 expression : "if(output = '{}', NULL, output)" ,
309315 } ,
310316 error : {
311317 name : "error" ,
312318 ...column ( "JSON" , {
313- description : "Error information" ,
319+ description :
320+ "If a run completely failed (after all attempts) then this error will be populated." ,
314321 example : '{"message": "Task failed"}' ,
315322 } ) ,
316323 expression : "if(error = '{}', NULL, error)" ,
@@ -320,40 +327,65 @@ export const runsSchema: TableSchema = {
320327 tags : {
321328 name : "tags" ,
322329 ...column ( "Array(String)" , {
323- description : "Run tags " ,
330+ description : "Tags you have added to the run. " ,
324331 customRenderType : "tags" ,
325332 example : '["user:123", "priority:high"]' ,
326333 } ) ,
327334 } ,
328335 task_version : {
329336 name : "task_version" ,
330- ...column ( "String" , { description : "Task version" , example : "20240115.1" } ) ,
337+ ...column ( "String" , {
338+ description : "The version of your code in reverse date format." ,
339+ example : "20240115.1" ,
340+ } ) ,
331341 } ,
332342 sdk_version : {
333343 name : "sdk_version" ,
334- ...column ( "String" , { description : "SDK version" , example : "3.3.0" } ) ,
344+ ...column ( "String" , {
345+ description : "The SDK package version for this run." ,
346+ example : "3.3.0" ,
347+ } ) ,
335348 } ,
336349 cli_version : {
337350 name : "cli_version" ,
338- ...column ( "String" , { description : "CLI version" , example : "3.3.0" } ) ,
351+ ...column ( "String" , {
352+ description : "The CLI package version for this run." ,
353+ example : "3.3.0" ,
354+ } ) ,
339355 } ,
340356 machine : {
341357 name : "machine" ,
342358 clickhouseName : "machine_preset" ,
343359 ...column ( "LowCardinality(String)" , {
344- description : "Machine preset " ,
360+ description : "The machine that the run executed on. " ,
345361 allowedValues : [ ...MACHINE_PRESETS ] ,
346362 customRenderType : "machine" ,
347363 example : "small-1x" ,
348364 } ) ,
349365 } ,
350-
351- // Flags
352366 is_test : {
353367 name : "is_test" ,
354368 ...column ( "UInt8" , { description : "Whether this is a test run (0 or 1)" , example : "0" } ) ,
355369 expression : "if(is_test > 0, true, false)" ,
356370 } ,
371+ concurrency_key : {
372+ name : "concurrency_key" ,
373+ ...column ( "String" , {
374+ description : "The concurrency key you passed in when triggering the run." ,
375+ example : "user:1234567" ,
376+ } ) ,
377+ } ,
378+ bulk_action_group_ids : {
379+ name : "bulk_action_group_ids" ,
380+ ...column ( "Array(String)" , {
381+ description : "Any bulk actions that operated on this run." ,
382+ example : '["bulk_12345678", "bulk_34567890"]' ,
383+ whereTransform : ( value : string ) => {
384+ logger . log ( `WHERE TRANSFORM: ${ value } ` ) ;
385+ return value . replace ( / ^ b u l k _ / , "" ) ;
386+ } ,
387+ } ) ,
388+ } ,
357389 } ,
358390} ;
359391
@@ -365,15 +397,7 @@ export const querySchemas: TableSchema[] = [runsSchema];
365397/**
366398 * Default query for the query editor
367399 */
368- export const defaultQuery = `SELECT
369- run_id,
370- task_identifier,
371- status,
372- created_at,
373- usage_duration,
374- compute_cost,
375- invocation_cost,
376- machine,
400+ export const defaultQuery = `SELECT *
377401FROM runs
378- ORDER BY created_at DESC
379- LIMIT 10 ` ;
402+ ORDER BY triggered_at DESC
403+ LIMIT 100 ` ;
0 commit comments