Skip to content

Conversation

knollengewaechs
Copy link
Contributor

@knollengewaechs knollengewaechs commented Apr 10, 2025

URL of deployed dev instance (used for testing):

Changes

for training or inferences, this PR

  • renames infer_with_model to infer_neurons
  • renames train_model to train_neuron_model

it does not get rid of all occurrences in order to render past jobs with the given names correctly.

Steps to test:

  • this is best tested locally I think, because no worker is configured within dev deployments
  • you need to adjust the given default worker a bit in the database, by renaming train_model to train_neuron_model in supportedJobCommands. I assume this is done by the worker or from voxelytics usually
  • from the AI job modal, start an inference with a custom model
  • also start the training of a model
  • both should start without yielding errors, given the worker is configured correctly
  • in the job list view, they should be displayed nicely
  • again within the database, set the state to SUCCESS to see whether the results are shown correctly. add sth like {resultLink:"test"} as returnValue of a infer_neurons job with a custom model
  • to make sure old jobs with old types are also displayed correctly or at least dont break anything, check-out the master and do the same (start inference with custom model and start training), then switch back and have a look at the job page

TODOs:

  • is the result link correct for all types?

Issues:


(Please delete unneeded items, merge only when none are left open)

@knollengewaechs knollengewaechs self-assigned this Apr 10, 2025
Copy link
Contributor

coderabbitai bot commented Apr 10, 2025

📝 Walkthrough

Walkthrough

This change updates the naming and handling of custom model training and inference jobs across both backend and frontend code to align with new worker naming conventions. It introduces new job command values (train_neuron_model, infer_neurons), updates API endpoints and function names, and adjusts frontend enums and UI logic to reflect these changes. Deprecated job types are retained for backward compatibility in result displays. Routing, job transformation, and database tooling are also updated to support the new conventions.

Changes

Files/Paths Change Summary
app/controllers/AiModelController.scala, conf/webknossos.latest.routes Renamed the runTraining method and route to runNeuronTraining, updated job commands for training and inference to train_neuron_model and infer_neurons.
app/models/job/JobCommand.scala Added train_neuron_model to the JobCommand enum; no changes to job prioritization logic.
frontend/javascripts/types/api_flow_types.ts Renamed enum value TRAIN_MODEL to TRAIN_NEURON_MODEL, removed INFER_WITH_MODEL, added deprecated entries for backward compatibility, and added modelId property to the APIJob type.
frontend/javascripts/admin/job/job_list_view.tsx Updated job type checks and descriptions to use new enums, added rendering for AI segmentation with custom models, and adjusted conditions for deprecated job types.
frontend/javascripts/oxalis/view/action-bar/starting_job_modals.tsx Changed the job type used in CustomAiModelInferenceForm from INFER_WITH_MODEL to INFER_NEURONS.
frontend/javascripts/admin/api/jobs.ts Updated the job transformation to include modelId, renamed runTraining to runNeuronTraining, and updated its endpoint.
frontend/javascripts/oxalis/view/jobs/train_ai_model.tsx Updated import and usage to call runNeuronTraining instead of runTraining.
tools/postgres/dbtool.js Updated supported job commands in the SQL for enable-jobs to include train_neuron_model instead of train_model; reformatted a command description.
CHANGELOG.unreleased.md Added changelog entry documenting the renaming of custom model inference and training jobs to match worker conventions.

Possibly related PRs

  • Fix processing job list #8323: Adjusts job list view rendering logic and dataset link handling, directly related to changes in how job types and descriptions are displayed in the job list.

Suggested labels

backend, frontend, jobs, worker

Suggested reviewers

  • MichaelBuessemeyer

Poem

In the warren where neurons train,
Rabbits rename jobs, never in vain.
From models custom, to inference anew,
Commands align—old names bid adieu!
Hop to the future, conventions in tow,
With every new carrot, our garden will grow.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5fdf020 and 9a32e32.

📒 Files selected for processing (5)
  • app/controllers/AiModelController.scala (4 hunks)
  • conf/webknossos.latest.routes (1 hunks)
  • frontend/javascripts/admin/api/jobs.ts (3 hunks)
  • frontend/javascripts/oxalis/view/action-bar/starting_job_modals.tsx (3 hunks)
  • package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/controllers/AiModelController.scala
  • frontend/javascripts/admin/api/jobs.ts
  • conf/webknossos.latest.routes
  • frontend/javascripts/oxalis/view/action-bar/starting_job_modals.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: frontend-tests
  • GitHub Check: backend-tests
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@knollengewaechs
Copy link
Contributor Author

knollengewaechs commented Apr 10, 2025

@MichaelBuessemeyer
the comment
// Old jobs before the dataset renaming changes returned the output dataset name. // New jobs return the directory name. Thus, the resulting link should be
in Job.scala got me thinking whether the code needs to be adjusted there. I think it doesnt have to be adjusted because probably new jobs of types infer_with_model and infer_neurons are handled the same way here, but I thought I'd better ask. especially as I cant really test it well

@knollengewaechs knollengewaechs marked this pull request as ready for review April 10, 2025 16:29
@knollengewaechs knollengewaechs changed the title Adjust inference and training job names Adjust inference and training job names to worker Apr 10, 2025
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer left a comment

Choose a reason for hiding this comment

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

Thanks for doing the renaming so fast 🚀.

To get the worker automatically running with the new commands, dbtools.js needs to be adjusted. As I did this for testing anyway, I took the freedom to already push these changes. Please double check them 🙏

Moreover, I found a little bug where the legacy named job is not displayed correctly. Please find the comment already including a fix suggestion below.

@MichaelBuessemeyer
Copy link
Contributor

Oh and forgot to tell about the testing:

Testing worked fine except for bug noted.
Note: I did not let each job run as I started too many jobs for testing and this would take a long time.

@knollengewaechs
Copy link
Contributor Author

knollengewaechs commented Apr 16, 2025

To get the worker automatically running with the new commands, dbtools.js needs to be adjusted. As I did this for testing anyway, I took the freedom to already push these changes. Please double check them 🙏

LGTM! at least from a logical perspective without knowing much about dbtools.js. it was also working when I tested it, so the jobs "started" (not really in dev setup but put to pending) immediately after running yarn refresh-schema && yarn enable-jobs which seems to be the requirement

@knollengewaechs
Copy link
Contributor Author

@MichaelBuessemeyer thank you for the fast review! I incorporated the changes and tested it again.
as for the result links with or without directory name, these changes should not have an implication, right? (see #8524 (comment))

@MatthisCl
Copy link

@knollengewaechs thanks for the renaming :) could you change the parameter naming in app/controllers/AiModelController.scala lines 192-193? Should now be:

"layer_name" -> request.body.colorLayerName,
"bbox" -> boundingBox.toLiteral,

Not sure if other files need to be changed as well when renaming this, but that worked for me with local wk and vx
(naming wasn't consistent before, see JobController runInferNeuronsJob)

@knollengewaechs
Copy link
Contributor Author

@MatthisCl thank you for testing and noticing this! I renamed the parameters.

Not sure if other files need to be changed as well when renaming this, but that worked for me with local wk and vx
(naming wasn't consistent before, see JobController runInferNeuronsJob)

I am also not 100% sure, but I couldnt find any meaningful occurences of color_layer_name or bounding_box hinting at further use in the code. I think the commandArgs simply get written into the jobDAO, at least thats what I can tell from the code and I could also see the renaming of the arguments in the DB. maybe @MichaelBuessemeyer can comment on that quickly if he cares :)

@MichaelBuessemeyer
Copy link
Contributor

MichaelBuessemeyer commented Apr 23, 2025

I am also not 100% sure, but I couldnt find any meaningful occurences of color_layer_name or bounding_box hinting at further use in the code. I think the commandArgs simply get written into the jobDAO, at least thats what I can tell from the code and I could also see the renaming of the arguments in the DB.

Yeah afaik this is correc.t The only place in the code that might need adjustment is where the frontend extract relevant info from the command args. See jobs.tsx -> transformBackendJobToAPIJob. Likely line 25 needs to be adjusted to layerName: job.commandArgs.layer_name || job.commandArgs.volume_layer_name || job.commandArgs.color_layer_name, and boundingBox: job.commandArgs.bbox,-> boundingBox: job.commandArgs.bbox || job.commandArgs.bounding_box,

Please ignore that 🙈

@MichaelBuessemeyer
Copy link
Contributor

~~Yeah afaik this is correc.t The only place in the code that might need adjustment is where the frontend extract relevant info from the command args. See jobs.tsx -> transformBackendJobToAPIJob. Likely line 25 needs to be adjusted to layerName: job.commandArgs.layer_name || job.commandArgs.volume_layer_name || job.commandArgs.color_layer_name, and boundingBox: job.commandArgs.bbox,-> boundingBox: job.commandArgs.bbox || job.commandArgs.bounding_box, ~~

Oh damn. I misunderstood the changes. I thought bbox was renamed to bounding_box. So please do not mind my previous comment above. My mistake

@knollengewaechs
Copy link
Contributor Author

thanks for having a look! 🙏 @MichaelBuessemeyer So I think we might be good then :)

@daniel-wer
Copy link
Member

daniel-wer commented Apr 24, 2025

@MichaelBuessemeyer Could you have a look at the last comment? If possible I'd like to merge this today, and deploy it together with https://github.com/scalableminds/voxelytics/pull/4036 :)

Oh sorry, I didn't see the newest comment 🙈 Thank you!

Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer left a comment

Choose a reason for hiding this comment

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

Thanks for incoorperating the feedback and sorry for taking so much time until re-review from my side.

Everything except on small open TODO (see my comment) looks good and the code works great. The open TODO is only about a little cleaner naming in the code so imo no re-review should be necessary to not block this pr any longer :D

@daniel-wer
Copy link
Member

Thanks @MichaelBuessemeyer and @knollengewaechs. I addressed the last feedback and if everything is green I'll merge this later today :)

@daniel-wer daniel-wer merged commit b1a619b into master Apr 24, 2025
5 checks passed
@daniel-wer daniel-wer deleted the adjust_inference_and_training_job_names branch April 24, 2025 14:55
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.

4 participants