Skip to content

feat(ml): support multiple urls - #14347

Merged
mertalev merged 12 commits into
mainfrom
feat/ml-multi-remote
Dec 4, 2024
Merged

mertalev merged 12 commits into
mainfrom
feat/ml-multi-remote

Conversation

@mertalev

@mertalev mertalev commented Nov 25, 2024 •

Copy link
Copy Markdown
Member

Description

A current limitation of remote machine learning is that it expects constant uptime: jobs will fail to be processed if the remote container is down. This PR adds the ability to specify multiple URLs for remote machine learning that are attempted sequentially. This improves the reliability of the feature by allowing a fallback to the local machine learning container when the remote container is not available.

Note: this PR changes the server config type of the machine learning URL to an array. To avoid breaking every Immich instance, string fields are wrapped in an array before validation. I tested with the official mobile app and didn't notice any issues, but I'm not sure if there are any cases where this would be a breaking change.

Testing

Tested that machine learning tasks with one URL work, that specifying two URLs and making the first fail will lead to the second URL being used for that request, and tested the setting UI as in this video

remote-urls.mov

@github-actions github-actions Bot added documentation Improvements or additions to documentation 🖥️web 🗄️server labels Nov 25, 2024
@alextran1502

Copy link
Copy Markdown
Member

We are not using this property in the mobile app so as long as you can login, it is good

unnecessary `?.`
add load balancing section
doc formatting

wording

wording

linting
@mertalev
mertalev force-pushed the feat/ml-multi-remote branch from 02083a0 to b164b9e Compare November 25, 2024 22:59

@danieldietzler danieldietzler 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.

Code looks good to me, will probably give it a spin tomorrow

Comment thread docs/docs/guides/remote-machine-learning.md Outdated
Comment thread server/src/dtos/system-config.dto.ts

@alextran1502 alextran1502 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.

Good work! Thank you

@jrasm91 jrasm91 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.

You have changed it from a string to a list, but all the variable names are still url, which is confusing imo. Should it not be urls now? For compatibility we could support both for a time, give a warning for url, and map that to urls

@mertalev
mertalev enabled auto-merge (squash) December 4, 2024 19:58
@mertalev
mertalev merged commit 4bf1b84 into main Dec 4, 2024
@mertalev
mertalev deleted the feat/ml-multi-remote branch December 4, 2024 20:17
yosit pushed a commit to yosit/immich that referenced this pull request Dec 20, 2024
* support multiple url

* update api

* styling

unnecessary `?.`

* update docs, make new url field go first

add load balancing section

* update tests

doc formatting

wording

wording

linting

* small styling

* `url` -> `urls`

* fix tests

* update docs

* make docusaurus happy

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants