speedy-utils 1.1.40__py3-none-any.whl → 1.1.42__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.
@@ -3,13 +3,59 @@ import argparse
3
3
  import itertools
4
4
  import multiprocessing # Import multiprocessing module
5
5
  import os
6
+ import re
6
7
  import shlex # To properly escape command line arguments
7
8
  import shutil
9
+ import subprocess
8
10
 
9
11
 
10
12
  taskset_path = shutil.which('taskset')
11
13
 
12
14
 
15
+ def get_existing_tmux_sessions():
16
+ """Get list of existing tmux session names."""
17
+ try:
18
+ result = subprocess.run(
19
+ ['tmux', 'list-sessions', '-F', '#{session_name}'],
20
+ capture_output=True,
21
+ text=True,
22
+ )
23
+ if result.returncode == 0:
24
+ return result.stdout.strip().split('\n')
25
+ return []
26
+ except FileNotFoundError:
27
+ # tmux not installed
28
+ return []
29
+
30
+
31
+ def get_next_session_name(base_name='mpython'):
32
+ """Get next available session name.
33
+
34
+ If 'mpython' doesn't exist, return 'mpython'.
35
+ If 'mpython' exists, return 'mpython-1', 'mpython-2', etc.
36
+ """
37
+ existing_sessions = get_existing_tmux_sessions()
38
+
39
+ if base_name not in existing_sessions:
40
+ return base_name
41
+
42
+ # Find all existing mpython-N sessions
43
+ pattern = re.compile(rf'^{re.escape(base_name)}-(\d+)$')
44
+ existing_numbers = []
45
+
46
+ for session in existing_sessions:
47
+ match = pattern.match(session)
48
+ if match:
49
+ existing_numbers.append(int(match.group(1)))
50
+
51
+ # Find the next available number
52
+ next_num = 1
53
+ if existing_numbers:
54
+ next_num = max(existing_numbers) + 1
55
+
56
+ return f'{base_name}-{next_num}'
57
+
58
+
13
59
  def assert_script(python_path):
14
60
  with open(python_path) as f:
15
61
  code_str = f.read()
@@ -30,10 +76,7 @@ def assert_script(python_path):
30
76
 
31
77
  def run_in_tmux(commands_to_run, tmux_name, num_windows):
32
78
  with open('/tmp/start_multirun_tmux.sh', 'w') as script_file:
33
- # first cmd is to kill the session if it exists
34
-
35
79
  script_file.write('#!/bin/bash\n\n')
36
- script_file.write(f'tmux kill-session -t {tmux_name}\nsleep .1\n')
37
80
  script_file.write(f'tmux new-session -d -s {tmux_name}\n')
38
81
  for i, cmd in enumerate(itertools.cycle(commands_to_run)):
39
82
  if i >= num_windows:
@@ -99,9 +142,11 @@ def main():
99
142
 
100
143
  cmds.append(fold_cmd)
101
144
 
102
- run_in_tmux(cmds, 'mpython', args.total_fold)
145
+ session_name = get_next_session_name('mpython')
146
+ run_in_tmux(cmds, session_name, args.total_fold)
103
147
  os.chmod('/tmp/start_multirun_tmux.sh', 0o755) # Make the script executable
104
148
  os.system('/tmp/start_multirun_tmux.sh')
149
+ print(f'Started tmux session: {session_name}')
105
150
 
106
151
 
107
152
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: speedy-utils
3
- Version: 1.1.40
3
+ Version: 1.1.42
4
4
  Summary: Fast and easy-to-use package for data science
5
5
  Project-URL: Homepage, https://github.com/anhvth/speedy
6
6
  Project-URL: Repository, https://github.com/anhvth/speedy
@@ -45,7 +45,8 @@ Requires-Dist: tabulate
45
45
  Requires-Dist: tqdm
46
46
  Requires-Dist: xxhash
47
47
  Provides-Extra: ray
48
- Requires-Dist: ray>=2.49.1; (python_version >= '3.9') and extra == 'ray'
48
+ Requires-Dist: ray[data,llm]>=2.40.0; extra == 'ray'
49
+ Requires-Dist: vllm>=0.6.3; extra == 'ray'
49
50
  Description-Content-Type: text/markdown
50
51
 
51
52
  # Speedy Utils
@@ -1,12 +1,13 @@
1
- llm_utils/__init__.py,sha256=tSo9RfmOhH1ofZseRtwr4iOpIQ1zKRocAzmuy53RgiI,1634
1
+ llm_utils/__init__.py,sha256=_NUOQLYe67KQEsxIieePJfU6u9eb7_BS8RnuW31l7mE,1685
2
2
  llm_utils/group_messages.py,sha256=_XuFkEkO_iQDjVVx80XNFpufGH6iIDwHPDoCRJa60Ak,3691
3
+ llm_utils/llm_ray.py,sha256=lnSq3eLyjfnODbIDgAzxrGqddqK-yUdOuHaDp6aMLZQ,12490
3
4
  llm_utils/chat_format/__init__.py,sha256=a7BKtBVktgLMq2Do4iNu3YfdDdTG1v9M_BkmaEorp5c,775
4
5
  llm_utils/chat_format/display.py,sha256=Lffjzna9_vV3QgfiXZM2_tuVb3wqA-WxwrmoAjsJigw,17356
5
6
  llm_utils/chat_format/transform.py,sha256=PJ2g9KT1GSbWuAs7giEbTpTAffpU9QsIXyRlbfpTZUQ,5351
6
7
  llm_utils/chat_format/utils.py,sha256=M2EctZ6NeHXqFYufh26Y3CpSphN0bdZm5xoNaEJj5vg,1251
7
8
  llm_utils/lm/__init__.py,sha256=4jYMy3wPH3tg-tHFyWEWOqrnmX4Tu32VZCdzRGMGQsI,778
8
9
  llm_utils/lm/base_prompt_builder.py,sha256=_TzYMsWr-SsbA_JNXptUVN56lV5RfgWWTrFi-E8LMy4,12337
9
- llm_utils/lm/llm.py,sha256=2vq8BScwp4gWb89EmUPaiBCzkBSr0x2B3qJLaPM11_M,19644
10
+ llm_utils/lm/llm.py,sha256=4nTBNvIZfsKUZo5SdllLQOp3w-HohR3B1hcfUnYDl7A,20014
10
11
  llm_utils/lm/llm_signature.py,sha256=vV8uZgLLd6ZKqWbq0OPywWvXAfl7hrJQnbtBF-VnZRU,1244
11
12
  llm_utils/lm/lm_base.py,sha256=Bk3q34KrcCK_bC4Ryxbc3KqkiPL39zuVZaBQ1i6wJqs,9437
12
13
  llm_utils/lm/mixins.py,sha256=Nz7CwJFBOvbZNbODUlJC04Pcbac3zWnT8vy7sZG_MVI,24906
@@ -29,7 +30,7 @@ llm_utils/vector_cache/core.py,sha256=VXuYJy1AX22NHKvIXRriETip5RrmQcNp73-g-ZT774
29
30
  llm_utils/vector_cache/types.py,sha256=CpMZanJSTeBVxQSqjBq6pBVWp7u2-JRcgY9t5jhykdQ,438
30
31
  llm_utils/vector_cache/utils.py,sha256=OsiRFydv8i8HiJtPL9hh40aUv8I5pYfg2zvmtDi4DME,1446
31
32
  speedy_utils/__imports.py,sha256=V0YzkDK4-QkK_IDXY1be6C6_STuNhXAKIp4_dM0coQs,7800
32
- speedy_utils/__init__.py,sha256=VkKqS4eHXd8YeDu2TAQ3Osqy70RSufUL1sECDoYzqvM,2685
33
+ speedy_utils/__init__.py,sha256=IXnlSPMc_2GJTtkfnobzm6wKA15_JvGe40yG8VG43N4,2822
33
34
  speedy_utils/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
35
  speedy_utils/common/clock.py,sha256=raLtMGIgzrRej5kUt7hOUm2ZZw2THVPo-q8dMvdZOxw,7354
35
36
  speedy_utils/common/function_decorator.py,sha256=GKXqRs_hHFFmhyhql0Br0o52WzekUnpNlm99NfaVwgY,2025
@@ -38,20 +39,23 @@ speedy_utils/common/notebook_utils.py,sha256=6mxXZcTHwYob3nobAzbSZnDyXRahFaaSko1
38
39
  speedy_utils/common/patcher.py,sha256=Rku-N4DJNue8BCLUx7y3ad_3t_WU2HleHKlbR0vhaRc,2319
39
40
  speedy_utils/common/report_manager.py,sha256=78KQ0gUzvbzT6EjHYZ5zgtV41cPRvdX8hnF2oSWA4qA,3849
40
41
  speedy_utils/common/utils_cache.py,sha256=1UAqOSb4nFVlhuQRfTEXCN-8Wf6yntXyMA6yp61-98I,26277
41
- speedy_utils/common/utils_io.py,sha256=w9AxMD_8V3Wyo_0o9OtXjVQS8Z3KhxQiOkrl2p8Np70,15762
42
+ speedy_utils/common/utils_io.py,sha256=94m_EZ2eIs3w2m0rx-QQWsREPpVJctpweYHco3byczQ,15876
42
43
  speedy_utils/common/utils_misc.py,sha256=ZRJCS7OJxybpVm1sasoeCYRW2TaaGCXj4DySYlQeVR8,2227
43
44
  speedy_utils/common/utils_print.py,sha256=AGDB7mgJnO00QkJBH6kJb46738q3GzMUZPwtQ248vQw,4763
44
- speedy_utils/multi_worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- speedy_utils/multi_worker/process.py,sha256=jk2K3oNnul1jop4g2U7-6GAekJ4fCyXCbj39WWAwXWQ,14925
45
+ speedy_utils/multi_worker/__init__.py,sha256=urcuxzaAJp-Rl3SIwHNre3x2vyHxLR7YGiDdm-Q8GQs,361
46
+ speedy_utils/multi_worker/dataset_ray.py,sha256=U_l_4Y7CVpaHiApsXQSdNvals8NK87LHPS_XHiJF3qs,10044
47
+ speedy_utils/multi_worker/parallel_gpu_pool.py,sha256=A7llZcQbRVZqwCqNRku7TpqGCdSoIzpdcTaupgqT5nI,6108
48
+ speedy_utils/multi_worker/process.py,sha256=y3zat4uCj_Pz2Z6nWiSBnvvPws_w2HA8M_V0S4ERHsg,24768
49
+ speedy_utils/multi_worker/progress.py,sha256=Ozeca-t-j1224n_dWwZkWzva9DC16SCLgScKeGtXLaQ,4717
46
50
  speedy_utils/multi_worker/thread.py,sha256=k4Ff4R2W0Ehet1zJ5nHQOfcsvOjnJzU6A2I18qw7_6M,21320
47
51
  speedy_utils/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- speedy_utils/scripts/mpython.py,sha256=aZvusJLKa3APVhabbFUAEo873VBm8Fym7HKGmVW4LyE,3843
52
+ speedy_utils/scripts/mpython.py,sha256=uJ-QPG43cyHUptMP4MnyH7IdSTh4mzVQAejy9o1cQoE,5068
49
53
  speedy_utils/scripts/openapi_client_codegen.py,sha256=GModmmhkvGnxljK4KczyixKDrk-VEcLaW5I0XT6tzWo,9657
50
54
  vision_utils/README.md,sha256=AIDZZj8jo_QNrEjFyHwd00iOO431s-js-M2dLtVTn3I,5740
51
55
  vision_utils/__init__.py,sha256=hF54sT6FAxby8kDVhOvruy4yot8O-Ateey5n96O1pQM,284
52
56
  vision_utils/io_utils.py,sha256=pI0Va6miesBysJcllK6NXCay8HpGZsaMWwlsKB2DMgA,26510
53
57
  vision_utils/plot.py,sha256=HkNj3osA3moPuupP1VguXfPPOW614dZO5tvC-EFKpKM,12028
54
- speedy_utils-1.1.40.dist-info/METADATA,sha256=DUvG4GyBA__qkUmjRZQIJ4l-SwBABum6nRw-J7guKDE,8048
55
- speedy_utils-1.1.40.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
56
- speedy_utils-1.1.40.dist-info/entry_points.txt,sha256=rwn89AYfBUh9SRJtFbpp-u2JIKiqmZ2sczvqyO6s9cI,289
57
- speedy_utils-1.1.40.dist-info/RECORD,,
58
+ speedy_utils-1.1.42.dist-info/METADATA,sha256=EWPvwJVrOh9P37W1tOiahbih2nbP9G4Z0xNqu8GKDWs,8071
59
+ speedy_utils-1.1.42.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
60
+ speedy_utils-1.1.42.dist-info/entry_points.txt,sha256=rwn89AYfBUh9SRJtFbpp-u2JIKiqmZ2sczvqyO6s9cI,289
61
+ speedy_utils-1.1.42.dist-info/RECORD,,