This repository was archived by the owner on Jul 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 181
fix: nightly updater #1202
Merged
Merged
fix: nightly updater #1202
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3e46bb1
fix: nightly updater
vansangpfiev d4c3f9c
fix: correct temp
vansangpfiev cd26a1d
fix: add e2e test
vansangpfiev cb3bd59
Merge branch 'dev' of github.com:janhq/nitro into fix/nightly-updater
vansangpfiev 233efc5
Merge branch 'dev' of github.com:janhq/nitro into fix/nightly-updater
vansangpfiev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import platform | ||
|
|
||
| import pytest | ||
| from test_runner import run | ||
|
|
||
|
|
||
| class TestCortexUpdate: | ||
| # We don't have stable release yet, so mark this test as skip for now | ||
| # Only able to test with beta and nightly | ||
| @pytest.mark.skip(reason="Stable release is not available yet") | ||
| def test_cortex_update(self): | ||
| exit_code, output, error = run("Update cortex", ["update"]) | ||
| assert exit_code == 0, f"Something wrong happened" | ||
| assert "Update cortex sucessfully" in output |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| #include "utils/file_logger.h" | ||
| #include "utils/file_manager_utils.h" | ||
| #include "utils/logging_utils.h" | ||
| #include "commands/cortex_upd_cmd.h" | ||
|
|
||
| #if defined(__APPLE__) && defined(__MACH__) | ||
| #include <libgen.h> // for dirname() | ||
|
|
@@ -91,8 +92,9 @@ void ForkProcess() { | |
| ZeroMemory(&si, sizeof(si)); | ||
| si.cb = sizeof(si); | ||
| ZeroMemory(&pi, sizeof(pi)); | ||
| auto exe = commands::GetCortexBinary(); | ||
| std::string cmds = | ||
| cortex_utils::GetCurrentPath() + "/cortex-cpp.exe --start-server"; | ||
| cortex_utils::GetCurrentPath() + "/" + exe + " --start-server"; | ||
| // Create child process | ||
| if (!CreateProcess( | ||
| NULL, // No module name (use command line) | ||
|
|
@@ -133,6 +135,17 @@ void ForkProcess() { | |
| int main(int argc, char* argv[]) { | ||
| { file_manager_utils::CreateConfigFileIfNotExist(); } | ||
|
|
||
| // Delete temporary file if it exists | ||
| auto temp = | ||
| file_manager_utils::GetExecutableFolderContainerPath() / "cortex_temp"; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After cortex update, we can only remove temporary file at the next start |
||
| if (std::filesystem::exists(temp)) { | ||
| try { | ||
| std::filesystem::remove(temp); | ||
| } catch (const std::exception& e) { | ||
| std::cerr << e.what() << '\n'; | ||
| } | ||
| } | ||
|
|
||
| // Check if this process is for python execution | ||
| if (argc > 1) { | ||
| if (strcmp(argv[1], "--run_python_file") == 0) { | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,7 @@ inline std::filesystem::path GetContainerFolderPath( | |
| } else if (type == "CudaToolkit") { | ||
| container_folder_path = current_path; | ||
| } else if (type == "Cortex") { | ||
| container_folder_path = current_path / "cortex"; | ||
| container_folder_path = std::filesystem::temp_directory_path() / "cortex"; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Download binary to temp folder |
||
| } else { | ||
| container_folder_path = current_path / "misc"; | ||
| } | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change accordingly to s3 structure