diff --git a/_sql/actions_and_analytics/generic_inference/jobs_by_ip_address.sql b/_sql/actions_and_analytics/generic_inference/jobs_by_ip_address.sql index fd392a8404..d4d64e798a 100644 --- a/_sql/actions_and_analytics/generic_inference/jobs_by_ip_address.sql +++ b/_sql/actions_and_analytics/generic_inference/jobs_by_ip_address.sql @@ -12,7 +12,7 @@ SELECT maybe_creator_user_token, users.username as maybe_creator_username, creator_ip_address, - count(*) as attempts + count(*) as total_job_count FROM ( SELECT maybe_creator_user_token, @@ -22,15 +22,16 @@ FROM ( creator_ip_address, created_at FROM generic_inference_jobs + where status = 'pending' ORDER BY id DESC - LIMIT 10000 + LIMIT 50000 ) as j WHERE j.created_at > NOW() - INTERVAL 30 MINUTE ) as jobs LEFT OUTER JOIN users ON users.token = jobs.maybe_creator_user_token group by maybe_creator_user_token, maybe_creator_username, creator_ip_address -order by attempts desc; +order by total_job_count desc; -- Bin histogram by creator user (including logged out) @@ -38,7 +39,7 @@ order by attempts desc; SELECT users.username as maybe_creator_username, maybe_creator_user_token, - count(*) as attempts + count(*) as total_job_count FROM ( SELECT maybe_creator_user_token, @@ -56,7 +57,7 @@ FROM ( LEFT OUTER JOIN users ON users.token = jobs.maybe_creator_user_token group by maybe_creator_user_token, maybe_creator_username -order by attempts desc; +order by total_job_count desc; -- Bin histogram by IP (logged in and non-logged in) diff --git a/_sql/actions_and_analytics/generic_inference/jobs_by_type.sql b/_sql/actions_and_analytics/generic_inference/jobs_by_type.sql index 57871991c4..475b8763bc 100644 --- a/_sql/actions_and_analytics/generic_inference/jobs_by_type.sql +++ b/_sql/actions_and_analytics/generic_inference/jobs_by_type.sql @@ -2,7 +2,19 @@ -- noinspection SqlNoDataSourceInspectionForFile -- noinspection SqlResolveForFile --- Histogram by type +-- Pending jobs +select + count(*), + job_type +from generic_inference_jobs +where status in ('pending', 'started', 'attempt_failed') +group by job_type; + +update generic_inference_jobs +set status = 'dead' +where status in ('pending', 'started', 'attempt_failed') + +-- Histogram by type over last 50,000 jobs -- NB: no index on ip, hence subquery select job_type, @@ -20,7 +32,7 @@ FROM ( ) as j group by job_type, inference_category, maybe_model_type; --- Histogram by type (still processing) +-- Histogram by type over last 50,000 jobs that are "still processing" -- NB: no index on ip, hence subquery select job_type, diff --git a/_sql/actions_and_analytics/model_weights/model_weights.sql b/_sql/actions_and_analytics/model_weights/model_weights.sql index 1eb3453c56..ba8d550357 100644 --- a/_sql/actions_and_analytics/model_weights/model_weights.sql +++ b/_sql/actions_and_analytics/model_weights/model_weights.sql @@ -35,7 +35,7 @@ from ( select maybe_model_token, count(*) as use_count from generic_inference_jobs where maybe_model_token IS NOT NULL - and created_at > NOW() - INTERVAL 1 DAY + and created_at > NOW() - INTERVAL 7 DAY and id > 40000000 group by maybe_model_token ) as r