Skip to content

Commit cc4a8a7

Browse files
Fix formatting
1 parent 68daa9b commit cc4a8a7

File tree

2 files changed

+78
-64
lines changed

2 files changed

+78
-64
lines changed

installation_and_upgrade/ibex_install_utils/install_tasks.py

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@
1414
from ibex_install_utils.tasks.server_tasks import ServerTasks
1515
from ibex_install_utils.tasks.system_tasks import SystemTasks
1616
from ibex_install_utils.tasks.vhd_tasks import VHDTasks
17+
from ibex_install_utils.user_prompt import UserPrompt
1718

1819

1920
class UpgradeInstrument:
2021
"""Class to upgrade the instrument installation to the given version of IBEX."""
2122

2223
def __init__(
2324
self,
24-
user_prompt,
25-
server_source_dir,
26-
client_source_dir,
27-
genie_python3_dir,
28-
ibex_version,
29-
file_utils=FileUtils(),
30-
):
25+
user_prompt: UserPrompt,
26+
server_source_dir: str,
27+
client_source_dir: str,
28+
genie_python3_dir: str,
29+
ibex_version: str,
30+
file_utils: FileUtils = FileUtils(),
31+
) -> None:
3132
"""Initializer.
3233
3334
Args:
@@ -111,14 +112,14 @@ def __init__(
111112
)
112113

113114
@staticmethod
114-
def icp_in_labview_modules():
115+
def icp_in_labview_modules() -> bool:
115116
"""Condition on which to install ICP_Binaries or
116117
117118
:return: True if the ICP is installed in labview modules, False otherwise
118119
"""
119120
return os.path.exists(LABVIEW_DAE_DIR)
120121

121-
def run_test_update(self):
122+
def run_test_update(self) -> None:
122123
"""Run a complete test upgrade on the current system"""
123124
self._system_tasks.user_confirm_upgrade_type_on_machine("Training Machine")
124125
self._system_tasks.install_or_upgrade_git()
@@ -136,10 +137,11 @@ def run_test_update(self):
136137
self._system_tasks.upgrade_notepad_pp()
137138
self._server_tasks.setup_log_rotation()
138139

139-
def remove_all_and_install_client_and_server(self):
140+
def remove_all_and_install_client_and_server(self) -> None:
140141
"""Either install or upgrade the ibex client and server"""
141142
self._system_tasks.confirm(
142-
"This script removes IBEX client and server and installs the latest build of both, and upgrade the "
143+
"This script removes IBEX client and server and installs "
144+
"the latest build of both, and upgrade the "
143145
"config/schema without any extra steps. Proceed?"
144146
)
145147

@@ -153,13 +155,13 @@ def remove_all_and_install_client_and_server(self):
153155
self._server_tasks.upgrade_instrument_configuration()
154156
self._server_tasks.install_shared_scripts_repository()
155157

156-
def run_instrument_tests(self):
158+
def run_instrument_tests(self) -> None:
157159
"""Run through client and server tests once installation / deployment has completed."""
158160
self._client_tasks.perform_client_tests()
159161
self._server_tasks.perform_server_tests()
160162
self._system_tasks.inform_instrument_scientists()
161163

162-
def run_instrument_install(self):
164+
def run_instrument_install(self) -> None:
163165
"""Do a first installation of IBEX on a new instrument."""
164166
self._system_tasks.confirm(
165167
"This script performs a first-time full installation of the IBEX server and client"
@@ -198,19 +200,20 @@ def run_instrument_install(self):
198200
self._python_tasks.update_script_definitions()
199201
self._server_tasks.setup_log_rotation()
200202

201-
def save_motor_params(self):
203+
def save_motor_params(self) -> None:
202204
self._server_tasks.save_motor_parameters_to_file()
203205

204-
def run_instrument_deploy(self):
206+
def run_instrument_deploy(self) -> None:
205207
"""Deploy a full IBEX upgrade on an existing instrument."""
206208
self._system_tasks.confirm(
207-
"This script performs a full upgrade of the IBEX server and client on an existing instrument. Proceed?"
209+
"This script performs a full upgrade of the IBEX server "
210+
"and client on an existing instrument. Proceed?"
208211
)
209212
self.run_instrument_deploy_pre_stop()
210213
self.run_instrument_deploy_main()
211214
self.run_instrument_deploy_post_start()
212215

213-
def run_instrument_deploy_post_start(self):
216+
def run_instrument_deploy_post_start(self) -> None:
214217
"""Upgrade an instrument. Steps to do after ibex has been started.
215218
216219
Current the server can not be started in this python script.
@@ -225,8 +228,9 @@ def run_instrument_deploy_post_start(self):
225228
self._system_tasks.put_autostart_script_in_startup_area()
226229
self._system_tasks.inform_instrument_scientists()
227230

228-
def run_instrument_deploy_main(self):
229-
"""Upgrade an instrument. Steps to do after ibex has been stopped but before it is restarted.
231+
def run_instrument_deploy_main(self) -> None:
232+
"""Upgrade an instrument. Steps to do after ibex has been stopped
233+
but before it is restarted.
230234
231235
Current the server can not be started or stopped in this python script.
232236
"""
@@ -253,7 +257,7 @@ def run_instrument_deploy_main(self):
253257
self._python_tasks.remove_instrument_script_githooks()
254258
self._server_tasks.setup_log_rotation()
255259

256-
def run_instrument_deploy_pre_stop(self):
260+
def run_instrument_deploy_pre_stop(self) -> None:
257261
"""Upgrade an instrument. Steps to do before ibex is stopped.
258262
259263
Current the server can not be started or stopped in this python script.
@@ -284,18 +288,18 @@ def run_instrument_deploy_pre_stop(self):
284288

285289
self._server_tasks.save_motor_blocks_blockserver_to_file()
286290

287-
def run_truncate_database(self):
291+
def run_truncate_database(self) -> None:
288292
"""Backup and truncate databases only"""
289293
self._mysql_tasks.backup_database()
290294
self._mysql_tasks.truncate_database()
291295

292-
def run_force_upgrade_mysql(self):
296+
def run_force_upgrade_mysql(self) -> None:
293297
""":key
294298
Do upgrade of mysql, with data dump.
295299
"""
296300
self._mysql_tasks.install_mysql(force=True)
297301

298-
def run_upgrade_mysql(self):
302+
def run_upgrade_mysql(self) -> None:
299303
""":key
300304
Do upgrade of mysql with no table recreate.
301305
"""
@@ -305,17 +309,17 @@ def run_update_calibrations_repository(self):
305309
"""update_calibrations_repository"""
306310
self._server_tasks.update_calibrations_repository()
307311

308-
def run_setup_log_rotation(self):
312+
def run_setup_log_rotation(self) -> None:
309313
"""setup_log_rotation"""
310314
self._server_tasks.setup_log_rotation()
311315

312-
def run_developer_update(self):
316+
def run_developer_update(self) -> None:
313317
"""Update all the developer tools to latest version"""
314318
self._mysql_tasks.install_mysql(force=False)
315319
self._system_tasks.check_java_installation()
316320
self._system_tasks.install_or_upgrade_git()
317321

318-
def run_vhd_creation(self):
322+
def run_vhd_creation(self) -> None:
319323
"""Automated job which creates a set of VHDs containing all IBEX components.
320324
321325
Note: this will run under jenkins, don't add interactive tasks to this list.
@@ -345,21 +349,23 @@ def run_vhd_creation(self):
345349

346350
self._vhd_tasks.deploy_vhds()
347351

348-
def mount_vhds(self):
352+
def mount_vhds(self) -> None:
349353
"""Task which actually mounts the VHDs (will be run as admin)"""
350354
self._vhd_tasks.mount_vhds()
351355

352-
def dismount_vhds(self):
356+
def dismount_vhds(self) -> None:
353357
"""Task which actually dismounts the VHDs (will be run as admin)"""
354358
self._vhd_tasks.dismount_vhds()
355359

356-
def request_dismount_vhds(self):
360+
def request_dismount_vhds(self) -> None:
357361
"""Standalone task to request VHDs to be dismounted"""
358362
self._vhd_tasks.request_dismount_vhds()
359363

360-
def run_vhd_post_install(self):
361-
"""This job is run by the MDT build system when it has built a windows image and mounted the VHDS
362-
It will tidy up and remaining jobs that were not possible when the vdh was created e.g. register mysql service
364+
def run_vhd_post_install(self) -> None:
365+
"""This job is run by the MDT build system when it has built
366+
a windows image and mounted the VHDS
367+
It will tidy up and remaining jobs that were not possible when
368+
the vdh was created e.g. register mysql service
363369
"""
364370
# self._server_tasks.update_icp(self.icp_in_labview_modules())
365371
self._mysql_tasks.configure_mysql_for_vhd_post_install()
@@ -416,7 +422,8 @@ def run_vhd_post_install(self):
416422
UpgradeInstrument.run_setup_log_rotation,
417423
"setup log rotation",
418424
),
419-
"developer_update": (UpgradeInstrument.run_developer_update, "install latest developer tools"),
425+
"developer_update": (UpgradeInstrument.run_developer_update,
426+
"install latest developer tools"),
420427
"create_vhds": (
421428
UpgradeInstrument.run_vhd_creation,
422429
"create a set of VHDS containing the latest IBEX release",
@@ -431,5 +438,6 @@ def run_vhd_post_install(self):
431438
UpgradeInstrument.run_vhd_post_install,
432439
"Run final task on system after VHD has been mounted locally",
433440
),
434-
"save_motor_params": (UpgradeInstrument.save_motor_params, "Save motor parameters to csv file"),
441+
"save_motor_params": (UpgradeInstrument.save_motor_params,
442+
"Save motor parameters to csv file"),
435443
}

0 commit comments

Comments
 (0)