Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ollama startup script for linux #159

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

fbricon
Copy link
Collaborator

@fbricon fbricon commented Nov 27, 2024

Signed-off-by: Fred Bricon [email protected]

@fbricon fbricon force-pushed the improve-ollama-linux-startup branch from f86d6ab to ebae717 Compare November 28, 2024 11:13
@fbricon fbricon force-pushed the improve-ollama-linux-startup branch 2 times, most recently from 6798093 to 14f4bf1 Compare December 18, 2024 11:23
Copy link

@halfline halfline left a comment

Choose a reason for hiding this comment

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

Overall, this is a nice clean up. It makes the script much tidier than it was before, but I wouldn't really say the script is more optimized (at least optimize is a loaded word that usually connotes runtime efficiency).
I'd change the commit message to something like this

start_ollama.sh: Refactor Ollama startup script for readability

The start_ollama.sh script is used by paver on Linux to help ensure
ollama gets started if it's not already running.

The script is functional, but largely open coded, and can be improved
for readability and maintainability sake.

This commit makes a few changes to improve the script:

- Introduce `readonly` constants for timeout and API endpoint URL
- Add and use helper functions (`ollama_is_running()`, `in_container()`, `command_exists()`) for legibility
- Add `main()` function entry point

start_ollama.sh Outdated Show resolved Hide resolved
start_ollama.sh Show resolved Hide resolved
start_ollama.sh Outdated Show resolved Hide resolved
start_ollama.sh Outdated Show resolved Hide resolved
start_ollama.sh Outdated Show resolved Hide resolved
start_ollama.sh Outdated Show resolved Hide resolved
start_ollama.sh Outdated Show resolved Hide resolved
@fbricon fbricon force-pushed the improve-ollama-linux-startup branch 2 times, most recently from 0837a30 to afe38d3 Compare December 18, 2024 16:13
@fbricon fbricon changed the title Optimize ollama startup script for linux Improve ollama startup script for linux Dec 18, 2024
The start_ollama.sh script is used by paver on Linux to help ensure
ollama gets started if it's not already running.

The script is functional, but largely open coded, and can be improved
for readability and maintainability sake.

This commit makes a few changes to improve the script:

- Introduce `readonly` constants for timeout and API endpoint URL
- Add and use helper functions (`ollama_is_running()`, `in_container()`, `command_exists()`) for legibility
- Add `main()` function entry point

Signed-off-by: Fred Bricon <[email protected]>
@fbricon fbricon force-pushed the improve-ollama-linux-startup branch from afe38d3 to a3e806c Compare December 18, 2024 16:28
Copy link

@halfline halfline left a comment

Choose a reason for hiding this comment

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

lgtm

@fbricon fbricon merged commit 6856622 into redhat-developer:main Dec 21, 2024
3 checks passed
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