Skip to content

Match jobs to a sample on the samples they name - #50

Merged
danielplohmann merged 1 commit into
mainfrom
fix/47-job-sample-match
Oct 15, 2026
Merged

danielplohmann merged 1 commit into
mainfrom
fix/47-job-sample-match

Conversation

@danielplohmann

Copy link
Copy Markdown
Collaborator

Closes #47.

McritInterface.queryJobs(sample_id) kept a job when job.parameters, the job rendered as text, contained the sample id as (id), (id,, ,id, or ,id). Job.parameters joins the arguments with ", ", so the last two forms never matched. A sample that was not a job's first argument was missed:

  • the second sample of getMatchesForSampleVs(5, 23);
  • a sample in the list of getMatchesForSampleVsGroup(7, [5, 23]), the per-sample job a cross compare creates in MCRIT 1.15.

The text test could also match on a keyword argument, for example a matching threshold equal to the sample id.

Change

_matchesSample reads the job's method and only the leading positional arguments that name samples: 1 for getMatchesForSample, 2 for getMatchesForSampleVs and getMatchesForSampleVsGroup, where the second may be a list. MCRIT passes the samples positionally and the matching knobs by keyword (MinHashIndex._submitMatchingJob, v1.15.0), and Job.arguments returns the positional values first. The ids are compared through int(), as Job.sample_id reads them. The server-side filter from #39 stays as it is.

The vendored Job class is unchanged. It mirrors core's, whose has_sample_id does not know getMatchesForSampleVsGroup either, so changing only the plugin's copy would make it deviate from core.

Testing

  • The job test now builds real Job objects in the format MCRIT stores: keyword arguments by name, positional ones as "0", "1", ...
    • Kept: the sample in first or second position, inside a group list, and stored as a string.
    • Dropped: a different sample id that contains the digits (230), a threshold equal to the id, a non-matching job, and a query job.
  • The test fails on main (only getMatchesForSample(23) is found) and passes with the change.
  • ruff format --check, ruff check, the sync checks and python -m pytest tests (334 tests) pass.

🤖 Generated with Claude Code

queryJobs kept a job when its parameters, rendered as text, contained the
sample id after "(" or ",". Job.parameters joins the arguments with ", ",
so the comma forms never matched, and a sample that was not a job's first
argument was missed: the second sample of getMatchesForSampleVs, or one of
the samples of a cross compare's getMatchesForSampleVsGroup. A matching
threshold equal to the sample id could also make a job match.

Jobs are now matched on their leading positional arguments, which MCRIT
uses for the samples, while the matching knobs are passed by keyword. The
ids are compared through int(), as Job.sample_id reads them.

Closes #47

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@danielplohmann
danielplohmann merged commit 0d8bf83 into main Oct 15, 2026
15 checks passed
@danielplohmann
danielplohmann deleted the fix/47-job-sample-match branch October 15, 2026 12:21
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.

Job selection misses a sample that is not the first argument of a matching job

1 participant