machineconfig 2.94__py3-none-any.whl → 2.97__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.

Potentially problematic release.


This version of machineconfig might be problematic. Click here for more details.

@@ -23,7 +23,6 @@ TMP_SERIALIZATION_DIR = Path.home().joinpath("tmp_results", "session_manager", "
23
23
 
24
24
  class ZellijLocalManager:
25
25
  """Manages multiple local zellij sessions and monitors their tabs and processes."""
26
-
27
26
  def __init__(self, session_layouts: list[LayoutConfig], ):
28
27
  self.session_name_prefix = "LocalJobMgr"
29
28
  self.session_layouts = session_layouts # Store the original config
@@ -15,8 +15,8 @@ import sys
15
15
  from machineconfig.scripts.python.fire_agents_help_launch import prep_agent_launch, get_agents_launch_layout, AGENTS
16
16
  from machineconfig.scripts.python.fire_agents_help_search import search_files_by_pattern, search_python_files
17
17
  from machineconfig.scripts.python.fire_agents_load_balancer import chunk_prompts, SPLITTING_STRATEGY, DEFAULT_AGENT_CAP
18
- from machineconfig.cluster.sessions_managers.zellij_local_manager import ZellijLocalManager
19
18
  from machineconfig.utils.options import choose_one_option
19
+ from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
20
20
  from machineconfig.utils.ve import get_repo_root
21
21
 
22
22
  SEARCH_STRATEGIES: TypeAlias = Literal["file_path", "keyword_search", "filename_pattern"]
@@ -141,10 +141,22 @@ manager.run_monitoring_routine()
141
141
  if len(layoutfile["layouts"][0]["layoutTabs"]) > 25:
142
142
  print("Too many agents (>25) to launch. Skipping launch.")
143
143
  sys.exit(0)
144
+ from machineconfig.cluster.sessions_managers.zellij_local_manager import ZellijLocalManager
144
145
  manager = ZellijLocalManager(session_layouts=layoutfile["layouts"])
145
146
  manager.start_all_sessions()
146
147
  manager.run_monitoring_routine()
147
148
 
148
149
 
150
+ def launch_sequentially(layoutfile: "LayoutsFile"):
151
+ from machineconfig.utils.utils2 import split
152
+ from machineconfig.cluster.sessions_managers.zellij_local_manager import ZellijLocalManager
153
+ for layout_chunk in split(layoutfile["layouts"], every=3):
154
+ manager = ZellijLocalManager(session_layouts=layout_chunk)
155
+ manager.start_all_sessions()
156
+ manager.run_monitoring_routine()
157
+
158
+
159
+
160
+
149
161
  if __name__ == "__main__": # pragma: no cover
150
162
  main()
@@ -4,13 +4,10 @@ from rich.panel import Panel
4
4
  from rich.console import Console
5
5
  import platform
6
6
  import subprocess
7
- from typing import Optional, Union, TypeVar, Iterable
7
+ from typing import Optional, Union, Iterable
8
8
  from machineconfig.utils.source_of_truth import WINDOWS_INSTALL_PATH, LINUX_INSTALL_PATH
9
9
 
10
10
 
11
- T = TypeVar("T")
12
-
13
-
14
11
  def check_tool_exists(tool_name: str) -> bool:
15
12
  if platform.system() == "Windows":
16
13
  tool_name = tool_name.replace(".exe", "") + ".exe"
@@ -35,20 +32,20 @@ def check_tool_exists(tool_name: str) -> bool:
35
32
  # return root_path.joinpath(tool_name).is_file()
36
33
 
37
34
 
38
- def choose_one_option(options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", msg: str = "", default: Optional[T] = None, fzf: bool = False, custom_input: bool = False) -> T:
35
+ def choose_one_option[T](options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", msg: str = "", default: Optional[T] = None, fzf: bool = False, custom_input: bool = False) -> T:
39
36
  choice_key = display_options(msg=msg, options=options, header=header, tail=tail, prompt=prompt, default=default, fzf=fzf, multi=False, custom_input=custom_input)
40
37
  assert not isinstance(choice_key, list)
41
38
  return choice_key
42
39
 
43
40
 
44
- def choose_multiple_options(options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", msg: str = "", default: Optional[T] = None, custom_input: bool = False) -> list[T]:
41
+ def choose_multiple_options[T](options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", msg: str = "", default: Optional[T] = None, custom_input: bool = False) -> list[T]:
45
42
  choice_key = display_options(msg=msg, options=options, header=header, tail=tail, prompt=prompt, default=default, fzf=True, multi=True, custom_input=custom_input)
46
43
  if isinstance(choice_key, list):
47
44
  return choice_key
48
45
  return [choice_key]
49
46
 
50
47
 
51
- def display_options(msg: str, options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", default: Optional[T] = None, fzf: bool = False, multi: bool = False, custom_input: bool = False) -> Union[T, list[T]]:
48
+ def display_options[T](msg: str, options: Iterable[T], header: str = "", tail: str = "", prompt: str = "", default: Optional[T] = None, fzf: bool = False, multi: bool = False, custom_input: bool = False) -> Union[T, list[T]]:
52
49
  # TODO: replace with https://github.com/tmbo/questionary
53
50
  # # also see https://github.com/charmbracelet/gum
54
51
  tool_name = "fzf"
@@ -5,11 +5,9 @@ from rich.console import Console
5
5
  from rich.panel import Panel
6
6
  import platform
7
7
  import subprocess
8
- from typing import TypeVar
9
8
  from pathlib import Path
10
9
 
11
10
 
12
- T = TypeVar("T")
13
11
  console = Console()
14
12
 
15
13
 
@@ -18,6 +18,19 @@ def randstr(length: int = 10, lower: bool = True, upper: bool = True, digits: bo
18
18
  return "".join(random.choices(population, k=length))
19
19
 
20
20
 
21
+ def split[T](iterable: list[T], every: int = 1, to: Optional[int] = None) -> list[list[T]]:
22
+ import math
23
+ every = every if to is None else math.ceil(len(iterable) / to)
24
+ res: list[list[T]] = []
25
+ for ix in range(0, len(iterable), every):
26
+ if ix + every < len(iterable):
27
+ tmp = iterable[ix : ix + every]
28
+ else:
29
+ tmp = iterable[ix : len(iterable)]
30
+ res.append(list(tmp))
31
+ return list(res)
32
+
33
+
21
34
  def read_ini(path: "Path", encoding: Optional[str] = None):
22
35
  if not Path(path).exists() or Path(path).is_dir():
23
36
  raise FileNotFoundError(f"File not found or is a directory: {path}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 2.94
3
+ Version: 2.97
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -17,7 +17,7 @@ machineconfig/cluster/sessions_managers/wt_local_manager.py,sha256=EqSdzHx5VLkax
17
17
  machineconfig/cluster/sessions_managers/wt_remote.py,sha256=7KT5D0FM9wwY8N3Mp9uO9rv3z29n6HIDJfPSLWXOIIs,8755
18
18
  machineconfig/cluster/sessions_managers/wt_remote_manager.py,sha256=V7Z_1sLGfCjyGh2rxbtnDCzrzlMYrdY_6uG3Gljp20o,19758
19
19
  machineconfig/cluster/sessions_managers/zellij_local.py,sha256=I2iQAS7G13lxQa0KCfHHXYMo9_54dDUwOYNKW_AWlek,17081
20
- machineconfig/cluster/sessions_managers/zellij_local_manager.py,sha256=eemuygUYs6jjAns_xjX-W25T8pVw4Ds7aXK8WQQ2Ot0,23464
20
+ machineconfig/cluster/sessions_managers/zellij_local_manager.py,sha256=U9UW6ybeMwPOqYRJafShAKqpXyQyUy1ybwDcNvhpGLg,23463
21
21
  machineconfig/cluster/sessions_managers/zellij_remote.py,sha256=G1SdycIHuCBMOnO5kfxDNN-boNxZ6PSh0xsZsDK8H1s,11039
22
22
  machineconfig/cluster/sessions_managers/zellij_remote_manager.py,sha256=2ZoSPrlsYJbugH8f8doNIDhmbv2M61DN9KIQNVUqE1k,8116
23
23
  machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py,sha256=CFGcZPFTZQJtFf0OvMUHhadZ0qbImCP3wxvbWYVcVYo,7445
@@ -172,7 +172,7 @@ machineconfig/scripts/python/devops_backup_retrieve.py,sha256=I7lghN_HJT1mPaZ7zc
172
172
  machineconfig/scripts/python/devops_devapps_install.py,sha256=xQaOHlr6ziHxrx7e5Ri7WQ-FjIW0hjzDhlPJC-3qwks,8596
173
173
  machineconfig/scripts/python/devops_update_repos.py,sha256=sqtkpQ2InUz-TFLhejN8EZqjZC1aBanAhohL6aHxPf0,8213
174
174
  machineconfig/scripts/python/dotfile.py,sha256=miL8mQH2AqPdnHSz0Cxa7qQavaOmzTD9DAF66H2PRzA,2259
175
- machineconfig/scripts/python/fire_agents.py,sha256=XIxOhI5q7DWpZJMs3rrhvdl0k8t-UICEpSp5W8Oc7bk,7716
175
+ machineconfig/scripts/python/fire_agents.py,sha256=HoT2NjNDB3lmmGjcsvFVf8dTtCAQKBh_DtdhLClL_Bw,8202
176
176
  machineconfig/scripts/python/fire_agents_help_launch.py,sha256=70iFF0wmFYKvaPsUy35_bIw5ivn5EdonahjSw1GTMIs,6125
177
177
  machineconfig/scripts/python/fire_agents_help_search.py,sha256=jEgPFMHL4s1VHQ1AJO1YdV2pyGdxdaCY5XxDUvC55nU,2991
178
178
  machineconfig/scripts/python/fire_agents_load_balancer.py,sha256=FeTfbp7n6jHHwMp4L6KVYO5HgenP57XpCyaab_vCwc0,2135
@@ -397,8 +397,8 @@ machineconfig/utils/installer.py,sha256=725N-0gmMbrWWh6_9sn-2w9aXrfjIPrnuu9o13T4
397
397
  machineconfig/utils/io_save.py,sha256=iC1YTH0MOlBS8bWUB8Xhdl4CG_bEKQ3OVwMohdCOazI,3145
398
398
  machineconfig/utils/links.py,sha256=5rDQ6Id-vTtJRFwOWX8xZDXIOR5lY0DgLy0HpxIKLhk,10247
399
399
  machineconfig/utils/notifications.py,sha256=q1kZM1y4ZmNhAHlEWZlzLE2HS3nnevrSUpunxd8rAT4,9307
400
- machineconfig/utils/options.py,sha256=F8w5AEvm8yxgipYpLgeHlXJtvoXigZvDJjSqA5TU9J0,8554
401
- machineconfig/utils/path.py,sha256=k0iyDaYsO-4yWCzjZ88-SxXDZLZPTGYX2WeSU8Pn-6w,8056
400
+ machineconfig/utils/options.py,sha256=wCP1oN-UFl8CbcCfJ7Orw_Ghy2ZKqNLiolzCGeRVfuk,8535
401
+ machineconfig/utils/path.py,sha256=csRyffpWYY5-sqeQCZyWi_z4b295EAztEmZWyvFYRW8,8012
402
402
  machineconfig/utils/path_reduced.py,sha256=hccGUTSMtggU-LpLNS7W_c1s-CqhjHMbTQ59-1EqgmY,52473
403
403
  machineconfig/utils/procs.py,sha256=aw2UyFvoJw69zDzfcxG46z-4O8MA5WsXvRpvFTqht-4,11484
404
404
  machineconfig/utils/scheduling.py,sha256=8xjeoR_D5QHT0d7299Mgsj6JUbvkE_PX_pWq3myi658,11184
@@ -406,7 +406,7 @@ machineconfig/utils/source_of_truth.py,sha256=GnjcVkKm11RyZFHGnPbne5YDEBYoZ5yryB
406
406
  machineconfig/utils/ssh.py,sha256=YBL2avhPUC43L1wxi2Doh2-cK-I7j81eUWEmfzAj9Jc,21196
407
407
  machineconfig/utils/terminal.py,sha256=k3xoMwJPGvmaeL9CxEIwrcQjRNN6EnJItoIIxXrUY8c,12258
408
408
  machineconfig/utils/upgrade_packages.py,sha256=H96zVJEWXJW07nh5vhjuSCrPtXGqoUb7xeJsFYYdmCI,3330
409
- machineconfig/utils/utils2.py,sha256=Y9bX4gaaPih7gbOeTcfPhQ3CcMFKGXgVCEQhVhljH4Q,2526
409
+ machineconfig/utils/utils2.py,sha256=wcvI9Vcz3A1syRL1qs75jVTmGsLyFh1ZIZlfGmG9cfE,2972
410
410
  machineconfig/utils/utils5.py,sha256=s2NFUBcm4Jeuet8sUC7WKGSrYT4BnqTog39bsynXLik,15166
411
411
  machineconfig/utils/ve.py,sha256=bi2bCiBbCdNICvXA8stXvMOmvtipd1dMePDTX_IYZcc,2765
412
412
  machineconfig/utils/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -419,8 +419,8 @@ machineconfig/utils/installer_utils/installer_class.py,sha256=3jknokPmaN4LuBR5n6
419
419
  machineconfig/utils/schemas/fire_agents/fire_agents_input.py,sha256=Pkp5nzmzuFOKhVHhaAcue7gmCOKrm7m0ft_FSdDn6X8,2350
420
420
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=9l8c02MVX_e-OOvGTlfM_Ef6wWw6_Wqru1g7HxWnhgU,615
421
421
  machineconfig/utils/schemas/repos/repos_types.py,sha256=beWlwPRNDBABmlzxHBYkAsMXS1MgFFdDZf4G2ge8J-I,408
422
- machineconfig-2.94.dist-info/METADATA,sha256=g73zifTyWLfyZujy1aydreg3ntB3wCrENUSpSjUpCh0,7049
423
- machineconfig-2.94.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
424
- machineconfig-2.94.dist-info/entry_points.txt,sha256=71EzS7_2LTIigVxC1YXNxHXhC9mu5Me2Feyq2KocXBI,977
425
- machineconfig-2.94.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
426
- machineconfig-2.94.dist-info/RECORD,,
422
+ machineconfig-2.97.dist-info/METADATA,sha256=l_UGz0o_tZJSeBW9AoTg8Ib3dwBvVVmRNTDZzWXJ4Us,7049
423
+ machineconfig-2.97.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
424
+ machineconfig-2.97.dist-info/entry_points.txt,sha256=71EzS7_2LTIigVxC1YXNxHXhC9mu5Me2Feyq2KocXBI,977
425
+ machineconfig-2.97.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
426
+ machineconfig-2.97.dist-info/RECORD,,