Skip to content

Fix job input sizes and resource metric selection - #191

Merged
hexylena merged 3 commits into
mainfrom
fix/job-metric-correctness
Nov 23, 2026
Merged

hexylena merged 3 commits into
mainfrom
fix/job-metric-correctness

Conversation

@afgane

@afgane afgane commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Came up while working on the new version of the KUI dashboard. job-metrics treated history dataset association IDs as dataset IDs, which lead to inputs being missed. For example, on usegalaxy.org, job 81088166 previously missed an input entirely; the corrected join includes its 1,092,097 bytes and counts it as one input.

The review also found inconsistent resource-metric selection. The queries now select runtime and allocation metrics from the core plugin and use cgroup memory peaks that exclude swap.

@hexylena hexylena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not part of our policy, but could you please rewrite your code comments in your own words, I find them hard to read as written. If you could also update the PR description to reflect what issues you encountered that led to this PR being created, it would be really helpful! :) I can somewhat kinda get that you encountered duplicately counted values which is indeed sub-optimal, but it looks like this is trying to do more and I don't understand why or what your job metrics looked like, that necessitates this

Comment thread parts/03-query-utils.sh Outdated
Comment on lines +276 to +278
# Internal SQL builder: arguments are trusted SQL expressions/literals supplied by
# query functions, never command-line values. Multiple names are alternatives
# for the same quantity, not values to combine or choose between.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reads like slop to me, could you please rewrite this in your own words? It would be helpful to say instead what the intention of this snippet is.

"never command line values" is not remotely correct in the context of this project where we freely inject command line values into queries as all user input is considered trusted and it's an error

Comment thread parts/22-query.sh Outdated
Only core-plugin metrics are used. Identical non-null duplicates count once;
conflicting or null observations leave that job's allocation unknown. Missing
values are not replaced with defaults. These commands do not establish compute
eligibility or collection coverage for a public indicator.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is "compute eligibility" and "collection covergae for a public indicator" supposed to mean?

Comment thread parts/22-query.sh Outdated
Comment on lines +1819 to +1822
CASE WHEN count(*) = count(metric_value) AND min(metric_value) = max(metric_value)
THEN min(metric_value) END AS metric_value
FROM job_metric_numeric
WHERE plugin = 'core' AND metric_name IN ('runtime_seconds', 'galaxy_slots')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the situation that would arise that would necessitate this. Could you provide an example of the situation you're fixing here?

Comment thread parts/22-query.sh Outdated
Comment on lines +6044 to +6083
- core_hrs: allocated core hours (runtime_seconds * galaxy_slots, 1 slot if unset)
- core_hrs: allocated core hours (runtime_seconds * galaxy_slots)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this changed? It seems pretty reasonable to assume cores = 1 for calculating core hours I don't see a rationale for this anywhere?

Comment thread test/metric-assertions.sql Outdated
@@ -0,0 +1,43 @@
CREATE TEMP TABLE expected_jobs (job_id bigint, total_filesize numeric, num_files bigint, runtime_seconds numeric, slots numeric, memory_bytes numeric);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't find value in any of these test cases, I fear. It's unit testing the SQL and mocking the galaxy tables which I don't think has enough ROI to maintain. If it did have value, we would've done it by now. Could I ask you to remove them?

(using sql and raising exceptions in sql is the sort of hilarious cursed thing I'd normally be into but it's a big cost to pay during testing for what we'd get from it.)

I had considered testing a reduced production database, but after spending a couple days trying to reduce and make it sufficiently private, the scope was still too large to make it worth it.

If galaxy wanted to offer an 'example' database, or something where y'all could guarantee nothing private was stored (perhaps a database from galaxy test cases?) then that would be really worth considering, we could download and test against that dump.

@afgane

afgane commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Some of the earlier changes had emerged from one agent making changes behind the other one's back to the changes guarded against that; removed now. Description updated.

@hexylena hexylena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks better!

@hexylena
hexylena merged commit 539f646 into main Nov 23, 2026
1 check passed
@hexylena
hexylena deleted the fix/job-metric-correctness branch November 23, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants