Repository navigation
feat: add an MLproject generated from main.py and bump the version to 0.1.5 - #10
Merged
Merged
Conversation
mortenoh
force-pushed
the
feat/mlproject
branch
from
October 15, 2026 11:39
b20dfdb to
daf5247
Compare
mortenoh
marked this pull request as ready for review
October 15, 2026 14:03
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an
MLprojectso the model runs withchapkit mlproject runandchap eval --run-config.as-chapkit, alongside the existingmain.pyservice.What changes
MLprojectis generated frommain.pybychapkit mlproject export(chapkit 2.4.0), somain.pystays the source of truth.make mlprojectregenerates it.make lint(and so CI) runschapkit mlproject export --check. It fails when the file is stale, or whenchapkit mlproject runwould read it as a different service (info, config options and defaults, accepted values, commands, adapters, config layout).meta_data.config_format: flat, sochapkit mlproject runwrites the same flatconfig.ymlasmain.py.read_config()inscripts/lib.Ralso accepts chap-core's nested layout (options underuser_option_values). chapkit before 2.4.0 ignoresmeta_data.config_formatand writes that layout, as in chap-core installs from before chore: require chapkit 2.4.0 for --run-config.as-chapkit (CLIM-1435) dhis2-chap/chap-core#737 (which requires 2.4.0 for--run-config.as-chapkit). Without this the scripts silently fell back to defaults for every option (a config withn_samples: 100produced 1000 samples).tools/test_lib.Rcovers both layouts.main.pysetsauthor_noteexplicitly. An MLproject without one serves the description instead, so this keeps/api/v1/infoidentical.make test-mlproject, and a new step in CI's docker-test job, start the image withchapkit mlproject run .and run chapkit's contract test andtools/api_smoke.py(real data with geometry, checks the config reaches the scripts) against it.MLprojectinto/work. chapkit>=2.4.0. Version 0.1.5 (main released 0.1.4 in fix: build the adjacency graph with planar geometry and release 0.1.4 #11). README documents the MLproject route.No environment is declared in the MLproject. The commands need R with INLA and GHRmodel, which the service image provides, and
--run-config.as-chapkitrefusesdocker_env. Chap's own MLproject runners are not supported: they pass the config as{model_config}under another file name, which the scripts do not read.Parity with the main.py service
/api/v1/infois identical, the OpenAPI paths are identical, and the config options have the same names, types, enums and defaults. Remaining differences, none settable from the MLproject:chapkit mlproject run --database PATHkeeps configs and trained models across restarts.main.pyuses 15s; pass--keepalive-interval 15tomlproject run(export warns about this).prediction_periodsdescription wording.Verification
make lint:chapkit mlproject export --checkpasses (with the expected keepalive warning).make test-unit: all checks pass, including both config layouts.make test-mlproject: contract test and API smoke test pass againstchapkit mlproject runin the image, which reports the flat layout. 33 rows x 100 samples.make test-apiagainst themain.pyservice still passes.Follow-ups
Most were addressed in dhis2-chap/chapkit#141 (released in 2.4.0):
meta_data.config_format/--config-format,--database,--keepalive-interval,--log-level, the hierarchy named after the MLproject, andchapkit mlproject exportreplacing this repo's own generator.--run-config.as-chapkit. The nested-layout support inread_config()stays for chap-core installs from before it.