Skip to content

Commit 89f7096

Browse files
Merge branch 'master' into Release-9.1
2 parents 1c011c1 + ea98d6f commit 89f7096

5 files changed

Lines changed: 62 additions & 45 deletions

File tree

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,26 @@ If you need the developer version, you are on the right place.
1515
* 3- Navigate to GiD's problemtype folder and delete any previous kratos.gid
1616
* Create there a link to our [kratos.gid](./kratos.gid/) downloaded in step 1
1717
* Windows: Simple shortcut to kratos.gid folder
18-
* 4- Navigate to kratos.gid/exec/
19-
* Create there a symbolic link to the kratos installation folder (where runkratos is located)
20-
* Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder
21-
* Windows : `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder)
22-
23-
### Step by step video
24-
https://www.youtube.com/watch?v=zZq7ypDdudo
25-
26-
## Launch modea
18+
* 4- Choose your execution mode:
19+
* 4.1- To execute Kratos using the standard pip packages:
20+
*- Python version recommended: 3.9
21+
*- Open a terminal and run `python3 -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.1.3`
22+
* 4.2- To execute Kratos using your compiled binaries:
23+
* Navigate to kratos.gid/exec/
24+
* Create there a symbolic link to the kratos installation folder (where runkratos is located)
25+
* Unix : `ln -s ~/Kratos Kratos` or maybe `ln -s ~/Kratos/bin/Release Kratos` if that's the destination folder
26+
* Windows : `mklink /J Kratos C:\kratos\bin\Release` (choose actual Kratos installation folder)
27+
* Step by step video: https://www.youtube.com/watch?v=zZq7ypDdudo
28+
* 4.3- To execute Kratos using docker, just install docker
29+
30+
### Launch modes
2731
In Kratos preferences, select the execution mode:
2832
* Pip packages: Kratos will be installed via `pip install`
2933
* local compiled: If you are a developer and build your applications, use this one
3034
* docker: If you do not want to install any dependency, just run via docker!
3135
* The default image is [fjgarate/kratos-run](https://hub.docker.com/repository/docker/fjgarate/kratos-run)
3236

33-
## Usage
37+
### Usage
3438
* Run GiD
3539
* Go to: Data / Problem type / kratos
3640
* kratos top menu / Developer mode (recommended)

kratos.gid/exec/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Launch via pip",
55
"script": "pip",
6-
"pip_packages": "KratosMultiphysics-all",
6+
"pip_packages": "KratosMultiphysics-all==9.1.3",
77
"dependency_check": "Kratos::CheckDependenciesPipMode"
88
},
99
{

kratos.gid/kratos.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ proc Kratos::Event_InitProblemtype { dir } {
130130
after 500 [list spdAux::CreateWindow]
131131
}
132132

133-
Kratos::CheckDependencies
134133
}
135134

136135
proc Kratos::InitGlobalVariables {dir} {
@@ -517,6 +516,7 @@ proc Kratos::Event_BeforeRunCalculation { batfilename basename dir problemtypedi
517516
}
518517
set app_run_brake [apps::ExecuteOnCurrentApp BreakRunCalculation]
519518
if {[write::isBooleanTrue $app_run_brake]} {return "-cancel-"}
519+
if {[Kratos::CheckDependencies] ne 0} {return [list "-cancel-" "Unable to run. Missing dependencies"]}
520520

521521
}
522522

kratos.gid/scripts/Launch.tcl

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ proc Kratos::GetPythonExeName { } {
4545
proc Kratos::GetDefaultPythonPath { } {
4646
set pat ""
4747
catch {
48-
set py [Kratos::GetPythonExeName]
49-
set pat [exec $py -c "import sys; print(sys.executable)" 2>@1]
48+
set py [Kratos::GetPythonExeName]
49+
set pat [exec $py -c "import sys; print(sys.executable)" 2>@1]
5050
}
5151
return $pat
5252
}
@@ -97,51 +97,57 @@ proc Kratos::GetMissingPipPackages { } {
9797

9898
proc Kratos::CheckDependencies { } {
9999
set curr_mode [Kratos::GetLaunchMode]
100-
# W $curr_mode
100+
set ret 0
101+
101102
if {[dict exists $curr_mode dependency_check]} {
102103
set deps [dict get $curr_mode dependency_check]
103-
$deps
104+
set ret [$deps]
104105
}
106+
ShowErrorsAndActions $ret
107+
return $ret
105108
}
106109

107-
proc Kratos::CheckDependenciesPipMode {} {
110+
proc Kratos::ShowErrorsAndActions {errs} {
108111
if { [GidUtils::IsTkDisabled] } {
109112
return 0
110113
}
111-
set py [Kratos::GetPythonExeName]
112-
set py_version [Kratos::pythonVersion $py]
113-
if {$py_version <= 0} {
114-
set msgBox_type yesno
115-
# -do_not_ask_again 1 -do_not_ask_again_key "kratos_install_python"
116-
set reply [tk_messageBox -icon warning -type $msgBox_type -parent .gid \
117-
-message "Python 3 not installed on this system. Do you want Kratos to install it?" \
118-
-title [_ "Missing python"]]
119-
if {[string equal $reply "yes"]} {
120-
Kratos::InstallAllPythonDependencies
114+
switch $errs {
115+
"MISSING_PYTHON" {
116+
W "Python 3 is not installed on this system. Please install it before run the case."
117+
}
118+
"MISSING_PIP" {
119+
W "Pip is not installed on your system. Please install it."
120+
}
121+
"MISSING_PIP_PACKAGES" {
122+
W "Run the following command on a terminal:\npip install --upgrade --force-reinstall --no-cache-dir $Kratos::pip_packages_required"
123+
}
124+
"DOCKER_NOT_FOUND" {
125+
W "Could not start docker. Please check if the Docker service is enabled."
121126
}
122-
if {[string equal $reply "cancel"]} {
127+
"EXE_NOT_FOUND" {
123128

124129
}
125130
}
126-
set pip_version [Kratos::pipVersion]
127-
if {$pip_version <= 0} {
128-
WarnWin "pip is not installed on your system. Please install it."
129-
} else {
130-
set missing_packages [Kratos::GetMissingPipPackages]
131-
if {[llength $missing_packages] > 0} {
132-
set msgBox_type yesno
133-
# -do_not_ask_again 1 -do_not_ask_again_key "kratos_install_python"
134-
set reply [tk_messageBox -icon warning -type $msgBox_type -parent .gid \
135-
-message "Python $py_version is installed, but there are some missing packages. Do you want Kratos to install them? \n\nPackages to be installed: \n$missing_packages" \
136-
-title [_ "Missing python packages"]]
137-
if {[string equal $reply "yes"]} {
138-
Kratos::InstallAllPythonDependencies
139-
}
140-
if {[string equal $reply "cancel"]} {
131+
}
141132

133+
proc Kratos::CheckDependenciesPipMode {} {
134+
set ret 0
135+
set py [Kratos::GetPythonExeName]
136+
set py_version [Kratos::pythonVersion $py]
137+
if {$py_version <= 0} {
138+
set ret "MISSING_PYTHON"
139+
} else {
140+
set pip_version [Kratos::pipVersion]
141+
if {$pip_version <= 0} {
142+
set ret "MISSING_PIP"
143+
} else {
144+
set missing_packages [Kratos::GetMissingPipPackages]
145+
if {[llength $missing_packages] > 0} {
146+
set ret "MISSING_PIP_PACKAGES"
142147
}
143148
}
144149
}
150+
return $ret
145151
}
146152
proc Kratos::CheckDependenciesLocalPipMode {} {
147153

@@ -150,7 +156,14 @@ proc Kratos::CheckDependenciesLocalMode {} {
150156

151157
}
152158
proc Kratos::CheckDependenciesDockerMode {} {
153-
159+
set ret 0
160+
try {
161+
exec docker ps
162+
} on error {msg} {
163+
W $msg
164+
set ret "DOCKER_NOT_FOUND"
165+
}
166+
return $ret
154167
}
155168

156169
proc Kratos::GetLaunchConfigurationFile { } {

kratos.gid/scripts/Menus.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ proc Kratos::ChangeMenus { } {
151151
if {[GidUtils::VersionCmp "14.1.4d"] <0 } { set cmd [list ChangeVariables kratos_preferences] } {set cmd [list PreferencesWindow kratos_preferences]}
152152
GiDMenu::InsertOption "Kratos" [list "Kratos preferences" ] [incr pos] PRE $cmd "" "" replace =
153153
GiDMenu::InsertOption "Kratos" [list "View current log" ] [incr pos] PREPOST [list Kratos::ViewLog] "" "" replace =
154-
GiDMenu::InsertOption "Kratos" [list "Install python and update dependencies" ] [incr pos] PREPOST [list Kratos::InstallAllPythonDependencies] "" "" replace =
154+
GiDMenu::InsertOption "Kratos" [list "Check dependencies" ] [incr pos] PREPOST [list Kratos::CheckDependencies] "" "" replace =
155155
GiDMenu::InsertOption "Kratos" [list "Refresh launch configurations" ] [incr pos] PREPOST [list Kratos::LoadLaunchModes 1] "" "" replace =
156156
GiDMenu::InsertOption "Kratos" [list "---"] [incr pos] PRE "" "" "" replace =
157157
GiDMenu::InsertOption "Kratos" [list "About Kratos" ] [incr pos] PREPOST [list Kratos::About] "" "" replace =

0 commit comments

Comments
 (0)