xmipp3-installer 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xmipp3_installer/__main__.py +1 -1
- xmipp3_installer/api_client/api_client.py +35 -34
- xmipp3_installer/api_client/assembler/installation_info_assembler.py +140 -145
- xmipp3_installer/application/cli/arguments/__init__.py +3 -2
- xmipp3_installer/application/cli/arguments/modes.py +112 -95
- xmipp3_installer/application/cli/arguments/params.py +63 -53
- xmipp3_installer/application/cli/cli.py +171 -190
- xmipp3_installer/application/cli/parsers/base_help_formatter.py +256 -235
- xmipp3_installer/application/cli/parsers/error_handler_parser.py +53 -53
- xmipp3_installer/application/cli/parsers/format.py +22 -22
- xmipp3_installer/application/cli/parsers/general_help_formatter.py +102 -84
- xmipp3_installer/application/cli/parsers/mode_help_formatter.py +144 -105
- xmipp3_installer/application/logger/__init__.py +5 -0
- xmipp3_installer/application/logger/errors.py +8 -8
- xmipp3_installer/application/logger/logger.py +218 -215
- xmipp3_installer/application/logger/predefined_messages.py +42 -35
- xmipp3_installer/application/user_interactions.py +6 -0
- xmipp3_installer/installer/constants/paths.py +6 -1
- xmipp3_installer/installer/handlers/cmake/cmake_handler.py +49 -53
- xmipp3_installer/installer/handlers/conda_handler.py +6 -6
- xmipp3_installer/installer/handlers/generic_package_handler.py +9 -9
- xmipp3_installer/installer/handlers/git_handler.py +152 -153
- xmipp3_installer/installer/handlers/shell_handler.py +87 -88
- xmipp3_installer/installer/handlers/versions_manager.py +20 -6
- xmipp3_installer/installer/installer_service.py +22 -8
- xmipp3_installer/installer/modes/mode_all_executor.py +61 -51
- xmipp3_installer/installer/modes/mode_clean/mode_clean_all_executor.py +44 -36
- xmipp3_installer/installer/modes/mode_clean/mode_clean_bin_executor.py +84 -74
- xmipp3_installer/installer/modes/mode_clean/mode_clean_executor.py +48 -34
- xmipp3_installer/installer/modes/mode_cmake/mode_cmake_executor.py +60 -47
- xmipp3_installer/installer/modes/mode_cmake/mode_compile_and_install_executor.py +52 -39
- xmipp3_installer/installer/modes/mode_cmake/mode_config_build_executor.py +68 -49
- xmipp3_installer/installer/modes/mode_config_executor.py +44 -33
- xmipp3_installer/installer/modes/mode_executor.py +14 -13
- xmipp3_installer/installer/modes/mode_get_sources_executor.py +121 -112
- xmipp3_installer/installer/modes/mode_git_executor.py +43 -31
- xmipp3_installer/installer/modes/mode_selector.py +6 -0
- xmipp3_installer/installer/modes/mode_sync/mode_add_model_executor.py +97 -83
- xmipp3_installer/installer/modes/mode_sync/mode_get_models_executor.py +53 -41
- xmipp3_installer/installer/modes/mode_sync/mode_sync_executor.py +41 -35
- xmipp3_installer/installer/modes/mode_sync/mode_test_executor.py +144 -77
- xmipp3_installer/installer/modes/mode_version_executor.py +161 -150
- xmipp3_installer/installer/orquestrator.py +24 -24
- xmipp3_installer/installer/urls.py +4 -3
- xmipp3_installer/repository/config.py +225 -227
- xmipp3_installer/repository/config_vars/__init__.py +5 -0
- xmipp3_installer/repository/config_vars/config_values_adapter.py +97 -91
- xmipp3_installer/repository/config_vars/default_values.py +24 -24
- xmipp3_installer/repository/config_vars/variables.py +9 -9
- xmipp3_installer/repository/invalid_config_line.py +17 -0
- xmipp3_installer/shared/file_operations.py +14 -12
- xmipp3_installer/shared/singleton.py +16 -17
- xmipp3_installer-1.1.0.dist-info/METADATA +86 -0
- xmipp3_installer-1.1.0.dist-info/RECORD +70 -0
- {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/WHEEL +1 -1
- xmipp3_installer-1.0.0.dist-info/METADATA +0 -729
- xmipp3_installer-1.0.0.dist-info/RECORD +0 -70
- {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/entry_points.txt +0 -0
- /xmipp3_installer-1.0.0.dist-info/LICENSE → /xmipp3_installer-1.1.0.dist-info/licenses/LICENSE.txt +0 -0
- {xmipp3_installer-1.0.0.dist-info → xmipp3_installer-1.1.0.dist-info}/top_level.txt +0 -0
xmipp3_installer/__main__.py
CHANGED
|
@@ -9,42 +9,43 @@ from xmipp3_installer.installer import urls
|
|
|
9
9
|
from xmipp3_installer.application.logger.logger import logger
|
|
10
10
|
|
|
11
11
|
def send_installation_attempt(installation_info: Dict):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
12
|
+
"""
|
|
13
|
+
### Sends a POST request to Xmipp's metrics's API.
|
|
14
|
+
|
|
15
|
+
#### Params:
|
|
16
|
+
- installation_info (dict): Dictionary containing all the installation information.
|
|
17
|
+
"""
|
|
18
|
+
if installation_info is None:
|
|
19
|
+
return
|
|
20
|
+
params = json.dumps(installation_info)
|
|
21
|
+
headers = {"Content-type": "application/json"}
|
|
22
|
+
parsed_url = urlparse(urls.API_URL)
|
|
23
|
+
conn = None
|
|
24
|
+
try:
|
|
25
|
+
conn = __get_https_connection(parsed_url, 6)
|
|
26
|
+
conn.request("POST", parsed_url.path, body=params, headers=headers)
|
|
27
|
+
conn.getresponse()
|
|
28
|
+
except TimeoutError:
|
|
29
|
+
logger(
|
|
30
|
+
logger.yellow("There was a timeout while sending installation data."),
|
|
31
|
+
show_in_terminal=False
|
|
32
|
+
)
|
|
33
|
+
finally:
|
|
34
|
+
if conn is not None:
|
|
35
|
+
conn.close()
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def __get_https_connection(parsed_url: ParseResult, timeout_seconds: int) -> http.client.HTTPSConnection:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
"""
|
|
40
|
+
### Establishes the connection needed to send the API call.
|
|
41
|
+
|
|
42
|
+
Separated to enable integration & E2E tests.
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
#### Params:
|
|
45
|
+
- parsed_url (ParseResult): Object containing all elements of the url.
|
|
46
|
+
- timeout_seconds (int): Number of seconds to wait until a timeout.
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
#### Returns:
|
|
49
|
+
- (HTTPSConnection): Established connection.
|
|
50
|
+
"""
|
|
51
|
+
return http.client.HTTPSConnection(parsed_url.hostname or "localhost", parsed_url.port, timeout=timeout_seconds)
|
|
@@ -14,168 +14,163 @@ from xmipp3_installer.installer.constants import paths
|
|
|
14
14
|
from xmipp3_installer.installer.handlers import shell_handler, git_handler, versions_manager
|
|
15
15
|
from xmipp3_installer.installer.handlers.cmake import cmake_constants, cmake_handler
|
|
16
16
|
|
|
17
|
-
def get_installation_info(version_manager: versions_manager.VersionsManager, ret_code: int=0) ->
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
17
|
+
def get_installation_info(version_manager: versions_manager.VersionsManager, ret_code: int=0) -> Dict:
|
|
18
|
+
"""
|
|
19
|
+
### Creates a dictionary with the necessary data for the API POST message.
|
|
20
|
+
|
|
21
|
+
#### Params:
|
|
22
|
+
- version_manager (VersionsManager): Object containing all the version-related info.
|
|
23
|
+
- ret_code (int): Optional. Return code for the API request.
|
|
24
|
+
|
|
25
|
+
#### Return:
|
|
26
|
+
- (dict): Dictionary with the required info.
|
|
27
|
+
"""
|
|
28
|
+
library_versions = cmake_handler.get_library_versions_from_cmake_file(
|
|
29
|
+
paths.LIBRARY_VERSIONS_FILE
|
|
30
|
+
)
|
|
31
|
+
environment_info = orquestrator.run_parallel_jobs(
|
|
32
|
+
[
|
|
33
|
+
__get_cpu_flags,
|
|
34
|
+
git_handler.get_current_branch,
|
|
35
|
+
git_handler.is_branch_up_to_date,
|
|
36
|
+
__is_installed_by_scipion,
|
|
37
|
+
__get_log_tail
|
|
38
|
+
],
|
|
39
|
+
[(), (), (), (), ()]
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
"user": {
|
|
44
|
+
"userId": __get_user_id()
|
|
45
|
+
},
|
|
46
|
+
"version": {
|
|
47
|
+
"os": get_os_release_name(),
|
|
48
|
+
"cpuFlags": environment_info[0],
|
|
49
|
+
"cuda": library_versions.get(cmake_constants.CMAKE_CUDA),
|
|
50
|
+
"cmake": library_versions.get(cmake_constants.CMAKE_CMAKE),
|
|
51
|
+
"gcc": library_versions.get(cmake_constants.CMAKE_GCC),
|
|
52
|
+
"gpp": library_versions.get(cmake_constants.CMAKE_GPP),
|
|
53
|
+
"mpi": library_versions.get(cmake_constants.CMAKE_MPI),
|
|
54
|
+
"python": library_versions.get(cmake_constants.CMAKE_PYTHON),
|
|
55
|
+
"sqlite": library_versions.get(cmake_constants.CMAKE_SQLITE),
|
|
56
|
+
"java": library_versions.get(cmake_constants.CMAKE_JAVA),
|
|
57
|
+
"hdf5": library_versions.get(cmake_constants.CMAKE_HDF5),
|
|
58
|
+
"jpeg": library_versions.get(cmake_constants.CMAKE_JPEG)
|
|
59
|
+
},
|
|
60
|
+
"xmipp": {
|
|
61
|
+
"branch": __get_installation_branch_name(
|
|
62
|
+
environment_info[1], version_manager
|
|
63
|
+
),
|
|
64
|
+
"updated": environment_info[2],
|
|
65
|
+
"installedByScipion": environment_info[3]
|
|
66
|
+
},
|
|
67
|
+
"returnCode": ret_code,
|
|
68
|
+
"logTail": environment_info[4] if ret_code else None # Only needed if something went wrong
|
|
69
|
+
}
|
|
70
70
|
|
|
71
71
|
def get_os_release_name() -> str:
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
"""
|
|
73
|
+
### Returns the name of the current system OS release.
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
#### Returns:
|
|
76
|
+
- (str): OS release name.
|
|
77
|
+
"""
|
|
78
|
+
platform_system = platform.system()
|
|
79
|
+
if platform_system == "Linux":
|
|
80
|
+
return f"{distro.name()} {distro.version()}"
|
|
81
|
+
return f"{platform_system} {platform.release()}"
|
|
82
82
|
|
|
83
83
|
def __get_installation_branch_name(branch_name: str, version_manager: versions_manager.VersionsManager) -> str:
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
"""
|
|
85
|
+
### Returns the branch or release name of Xmipp.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
#### Params:
|
|
88
|
+
- branch_name (str): Retrieved branch name.
|
|
89
|
+
- version_manager (VersionsManager): Object containing all the version-related info.
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
#### Return:
|
|
92
|
+
- (str): Release name if Xmipp is in a release branch, or the branch name otherwise.
|
|
93
|
+
"""
|
|
94
|
+
if not branch_name or branch_name == constants.MASTER_BRANCHNAME:
|
|
95
|
+
return version_manager.xmipp_version_number
|
|
96
|
+
return branch_name
|
|
97
97
|
|
|
98
98
|
def __get_user_id() -> str:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
99
|
+
"""
|
|
100
|
+
### Returns the unique user id for this machine.
|
|
101
|
+
|
|
102
|
+
#### Returns:
|
|
103
|
+
- (str): User id, or 'Anoymous' if there were any errors.
|
|
104
|
+
"""
|
|
105
|
+
identifier = __get_mac_address()
|
|
106
|
+
if not identifier:
|
|
107
|
+
identifier = getpass.getuser()
|
|
108
|
+
if not identifier:
|
|
109
|
+
return "Anonymous"
|
|
110
|
+
|
|
111
|
+
sha256 = hashlib.sha256()
|
|
112
|
+
sha256.update(identifier.encode())
|
|
113
|
+
return sha256.hexdigest()
|
|
114
114
|
|
|
115
115
|
def __get_cpu_flags() -> List[str]:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
"""
|
|
117
|
+
### This function obtains the list of compilation flags supported by the CPU.
|
|
118
|
+
|
|
119
|
+
#### Returns:
|
|
120
|
+
- (list(str)): List of flags supported by the CPU.
|
|
121
|
+
"""
|
|
122
|
+
flags_header = "Flags:"
|
|
123
|
+
ret_code, flags_line = shell_handler.run_shell_command(f'lscpu | grep \"{flags_header}\"')
|
|
124
|
+
if ret_code:
|
|
125
|
+
return []
|
|
126
|
+
flags_line = flags_line.replace(flags_header, "").strip()
|
|
127
|
+
return [flag for flag in flags_line.split(" ") if flag]
|
|
128
128
|
|
|
129
129
|
def __get_log_tail() -> Optional[str]:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
"""
|
|
131
|
+
### Returns the last lines of the installation log.
|
|
132
|
+
|
|
133
|
+
#### Returns:
|
|
134
|
+
- (str | None): Installation log's last lines, or None if there were any errors.
|
|
135
|
+
"""
|
|
136
|
+
ret_code, output = shell_handler.run_shell_command(
|
|
137
|
+
f"tail -n {constants.TAIL_LOG_NCHARS} {paths.LOG_FILE}"
|
|
138
|
+
)
|
|
139
|
+
return output if ret_code == 0 else None
|
|
140
140
|
|
|
141
141
|
def __get_mac_address() -> Optional[str]:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
"""
|
|
143
|
+
### Returns a physical MAC address for this machine. It prioritizes ethernet over wireless.
|
|
144
|
+
|
|
145
|
+
#### Returns:
|
|
146
|
+
- (str | None): MAC address, or None if there were any errors.
|
|
147
|
+
"""
|
|
148
|
+
ret_code, output = shell_handler.run_shell_command("ip addr")
|
|
149
|
+
return __find_mac_address_in_lines(output.split('\n')) if ret_code == 0 else None
|
|
150
150
|
|
|
151
151
|
def __find_mac_address_in_lines(lines: List[str]) -> Optional[str]:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return re.search(
|
|
169
|
-
r"link/ether ([0-9a-f:]{17})",
|
|
170
|
-
lines[line_index + 1]
|
|
171
|
-
).group(1)
|
|
172
|
-
return None
|
|
152
|
+
"""
|
|
153
|
+
### Returns a physical MAC address within the text lines provided.
|
|
154
|
+
|
|
155
|
+
#### Params:
|
|
156
|
+
- lines (list(str)): Lines of text where MAC address should be looked for.
|
|
157
|
+
|
|
158
|
+
#### Returns:
|
|
159
|
+
- (str | None): MAC address if found, None otherwise.
|
|
160
|
+
"""
|
|
161
|
+
for line_index in range(len(lines) - 1):
|
|
162
|
+
match = re.match(r"^\d+: (enp|wlp|eth|ens|eno)\w+", lines[line_index])
|
|
163
|
+
if not match:
|
|
164
|
+
continue
|
|
165
|
+
mac_match = re.search(r"link/ether ([0-9a-f:]{17})", lines[line_index + 1])
|
|
166
|
+
if mac_match:
|
|
167
|
+
return mac_match.group(1)
|
|
173
168
|
|
|
174
169
|
def __is_installed_by_scipion() -> bool:
|
|
175
|
-
|
|
176
|
-
|
|
170
|
+
"""
|
|
171
|
+
### Checks if the current xmipp installation is being carried out from Scipion.
|
|
177
172
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
173
|
+
#### Returns:
|
|
174
|
+
- (bool): True if the installation is executed by Scipion, False otherwise.
|
|
175
|
+
"""
|
|
176
|
+
return bool(os.getenv("SCIPION_SOFTWARE"))
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""### Containis all common constants needed for the argument parsing part of Xmipp's installation."""
|
|
2
2
|
|
|
3
|
+
from xmipp3_installer.installer.constants import paths
|
|
4
|
+
|
|
3
5
|
XMIPP_PROGRAM_NAME = "xmipp"
|
|
4
6
|
|
|
5
7
|
# Other variables
|
|
6
8
|
COMMON_USAGE_HELP_MESSAGE = 'Run \"./xmipp -h\" for usage help.'
|
|
7
|
-
|
|
8
|
-
DEFAULT_MODELS_DIR = DEFAULT_BUILD_DIR
|
|
9
|
+
DEFAULT_MODELS_DIR = paths.INSTALL_PATH
|
|
@@ -4,8 +4,10 @@ from xmipp3_installer.application.cli import arguments
|
|
|
4
4
|
from xmipp3_installer.application.cli.arguments.params import (
|
|
5
5
|
PARAM_SHORT, PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT, PARAM_OVERWRITE,
|
|
6
6
|
PARAM_MODELS_DIRECTORY, PARAM_TEST_NAMES, PARAM_SHOW_TESTS, PARAM_GIT_COMMAND,
|
|
7
|
-
PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE, PARAMS,
|
|
7
|
+
PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE, PARAMS, PARAM_ALL_FUNCTIONS,
|
|
8
|
+
PARAM_ALL_PROGRAMS, SHORT_VERSION, LONG_VERSION
|
|
8
9
|
)
|
|
10
|
+
from xmipp3_installer.installer import urls, constants
|
|
9
11
|
|
|
10
12
|
MODE = "mode"
|
|
11
13
|
|
|
@@ -25,106 +27,121 @@ MODE_VERSION = 'version'
|
|
|
25
27
|
|
|
26
28
|
# Modes with help message
|
|
27
29
|
MODES = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
30
|
+
'General': {
|
|
31
|
+
MODE_VERSION: ['Returns the version information. Add \'--short\' to print only the version number.'],
|
|
32
|
+
MODE_COMPILE_AND_INSTALL: ['Compiles and installs Xmipp based on already obtained sources.'],
|
|
33
|
+
MODE_ALL: [f'Default param. Runs {MODE_CONFIG}, {MODE_CONFIG_BUILD}, and {MODE_COMPILE_AND_INSTALL}.'],
|
|
34
|
+
MODE_CONFIG_BUILD: ['Configures the project with CMake.']
|
|
35
|
+
},
|
|
36
|
+
'Config': {
|
|
37
|
+
MODE_CONFIG: ['Generates a config file template with default values.'],
|
|
38
|
+
},
|
|
39
|
+
'Downloads': {
|
|
40
|
+
MODE_GET_MODELS: [
|
|
41
|
+
f'Downloads the Deep Learning Models required by the DLTK tools at dir/models ({arguments.DEFAULT_MODELS_DIR} by default).',
|
|
42
|
+
f'Visit {urls.DLTK_DOCS_URL} for more details.'
|
|
43
|
+
],
|
|
44
|
+
MODE_GET_SOURCES: [f'Clones Xmipp\'s source repositories {constants.XMIPP_CORE} & {constants.XMIPP_VIZ}.']
|
|
45
|
+
},
|
|
46
|
+
'Clean': {
|
|
47
|
+
MODE_CLEAN_BIN: ['Removes all compiled binaries.'],
|
|
48
|
+
MODE_CLEAN_ALL: ['Removes all compiled binaries and sources, leaves the repository as if freshly cloned (without pulling).']
|
|
49
|
+
},
|
|
50
|
+
'Test': {
|
|
51
|
+
MODE_TEST: [
|
|
52
|
+
'Runs Xmipp\'s tests.',
|
|
53
|
+
f'If used with \'{PARAMS[PARAM_TEST_NAMES][SHORT_VERSION]}\', only the tests provided will run.',
|
|
54
|
+
f'If used with \'{PARAMS[PARAM_SHOW_TESTS][LONG_VERSION]}\', a list the tests available and how to invoke them will be shown.',
|
|
55
|
+
f'If used with \'{PARAMS[PARAM_ALL_FUNCTIONS][LONG_VERSION]}\', all function tests will run.',
|
|
56
|
+
f'If used with \'{PARAMS[PARAM_ALL_PROGRAMS][LONG_VERSION]}\', all program tests will run.'
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
'Developers': {
|
|
60
|
+
MODE_GIT: ['Runs the given git action for all source repositories.'],
|
|
61
|
+
MODE_ADD_MODEL: [
|
|
62
|
+
"Takes a DeepLearning model from the modelPath, makes a tgz of it and uploads the .tgz according to the <login>.",
|
|
63
|
+
"This mode is used to upload a model folder to the Scipion/Xmipp server.",
|
|
64
|
+
"Usually the model folder contains big files used to feed deep learning procedures "
|
|
65
|
+
"with pretrained data. All the models stored in the server will be downloaded "
|
|
66
|
+
"using the 'get_models' mode, during the compilation/installation time, "
|
|
67
|
+
"or with scipion3 installb deepLearningToolkit.",
|
|
68
|
+
"Param <modelsPath> must be an absolute path.",
|
|
69
|
+
"",
|
|
70
|
+
"Usage: -> ./xmipp addModel <usr@server> <modelsPath> [--update]",
|
|
71
|
+
"Steps: 0. modelName = basename(modelsPath) <- Please, check the folders name!",
|
|
72
|
+
" 1. Packing in 'xmipp_model_modelName.tgz'",
|
|
73
|
+
" 2. Check if that model already exists (use --update to override an existing model)",
|
|
74
|
+
" 3. Upload the model to the server.",
|
|
75
|
+
" 4. Update the MANIFEST file.",
|
|
76
|
+
"",
|
|
77
|
+
"The model name will be the folder name in <modelsPath>",
|
|
78
|
+
"Must have write permissions to such machine."
|
|
79
|
+
]
|
|
80
|
+
}
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
# Arguments of each mode, sorted by group
|
|
84
|
+
# Inside each mode, params are grouped by mutually exclusive groups
|
|
85
|
+
# For example: MYMODE: [[PARAM1, PARAM2], [PARAM3, PARAM4]] would translate to
|
|
86
|
+
# "mymode ([param1] [param2] | [param3] [param4])" in the general help message
|
|
72
87
|
MODE_ARGS = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
MODE_VERSION: [PARAM_SHORT],
|
|
89
|
+
MODE_COMPILE_AND_INSTALL: [PARAM_JOBS, PARAM_KEEP_OUTPUT],
|
|
90
|
+
MODE_ALL: [PARAM_JOBS, PARAM_BRANCH, PARAM_KEEP_OUTPUT],
|
|
91
|
+
MODE_CONFIG_BUILD: [PARAM_KEEP_OUTPUT],
|
|
92
|
+
MODE_CONFIG: [PARAM_OVERWRITE],
|
|
93
|
+
MODE_GET_MODELS: [PARAM_MODELS_DIRECTORY],
|
|
94
|
+
MODE_GET_SOURCES: [PARAM_BRANCH, PARAM_KEEP_OUTPUT],
|
|
95
|
+
MODE_CLEAN_BIN: [],
|
|
96
|
+
MODE_CLEAN_ALL: [],
|
|
97
|
+
MODE_TEST: [[PARAM_TEST_NAMES], [PARAM_SHOW_TESTS], [PARAM_ALL_FUNCTIONS], [PARAM_ALL_PROGRAMS]],
|
|
98
|
+
MODE_GIT: [PARAM_GIT_COMMAND],
|
|
99
|
+
MODE_ADD_MODEL: [PARAM_LOGIN, PARAM_MODEL_PATH, PARAM_UPDATE]
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
# Examples for the help message of each mode
|
|
88
103
|
MODE_EXAMPLES = {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
104
|
+
MODE_VERSION: [
|
|
105
|
+
f'./xmipp {MODE_VERSION}',
|
|
106
|
+
f'./xmipp {MODE_VERSION} {PARAMS[PARAM_SHORT][LONG_VERSION]}',
|
|
107
|
+
],
|
|
108
|
+
MODE_COMPILE_AND_INSTALL: [
|
|
109
|
+
f'./xmipp {MODE_COMPILE_AND_INSTALL}',
|
|
110
|
+
f'./xmipp {MODE_COMPILE_AND_INSTALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
|
|
111
|
+
],
|
|
112
|
+
MODE_ALL: [
|
|
113
|
+
'./xmipp',
|
|
114
|
+
f'./xmipp {MODE_ALL}',
|
|
115
|
+
f'./xmipp {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20',
|
|
116
|
+
f'./xmipp {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel',
|
|
117
|
+
f'./xmipp {MODE_ALL} {PARAMS[PARAM_JOBS][SHORT_VERSION]} 20 '
|
|
118
|
+
f'{PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
|
|
119
|
+
],
|
|
120
|
+
MODE_CONFIG_BUILD: [],
|
|
121
|
+
MODE_CONFIG: [
|
|
122
|
+
f'./xmipp {MODE_CONFIG} {PARAMS[PARAM_OVERWRITE][LONG_VERSION]}'
|
|
123
|
+
],
|
|
124
|
+
MODE_GET_MODELS: [
|
|
125
|
+
f'./xmipp {MODE_GET_MODELS}',
|
|
126
|
+
f'./xmipp {MODE_GET_MODELS} {PARAMS[PARAM_MODELS_DIRECTORY][SHORT_VERSION]} /path/to/my/model/directory'
|
|
127
|
+
],
|
|
128
|
+
MODE_GET_SOURCES: [
|
|
129
|
+
f'./xmipp {MODE_GET_SOURCES}'
|
|
130
|
+
f'./xmipp {MODE_GET_SOURCES} {PARAMS[PARAM_BRANCH][SHORT_VERSION]} devel'
|
|
131
|
+
],
|
|
132
|
+
MODE_CLEAN_BIN: [],
|
|
133
|
+
MODE_CLEAN_ALL: [],
|
|
134
|
+
MODE_TEST: [
|
|
135
|
+
f'./xmipp {MODE_TEST} xmipp_sample_test',
|
|
136
|
+
f'./xmipp {MODE_TEST} {PARAMS[PARAM_SHOW_TESTS][LONG_VERSION]}',
|
|
137
|
+
f'./xmipp {MODE_TEST} {PARAMS[PARAM_ALL_FUNCTIONS][LONG_VERSION]}',
|
|
138
|
+
f'./xmipp {MODE_TEST} {PARAMS[PARAM_ALL_PROGRAMS][LONG_VERSION]}'
|
|
139
|
+
],
|
|
140
|
+
MODE_GIT: [
|
|
141
|
+
f'./xmipp {MODE_GIT} pull',
|
|
142
|
+
f'./xmipp {MODE_GIT} checkout devel'
|
|
143
|
+
],
|
|
144
|
+
MODE_ADD_MODEL: [
|
|
145
|
+
f'./xmipp {MODE_ADD_MODEL} myuser@127.0.0.1 /home/myuser/mymodel'
|
|
146
|
+
]
|
|
130
147
|
}
|