machineconfig 1.94__py3-none-any.whl → 1.96__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.
- machineconfig/cluster/cloud_manager.py +445 -343
- machineconfig/cluster/data_transfer.py +63 -56
- machineconfig/cluster/distribute.py +284 -280
- machineconfig/cluster/file_manager.py +234 -237
- machineconfig/cluster/job_params.py +133 -133
- machineconfig/cluster/loader_runner.py +183 -149
- machineconfig/cluster/remote_machine.py +269 -252
- machineconfig/cluster/script_execution.py +215 -209
- machineconfig/cluster/script_notify_upon_completion.py +50 -43
- machineconfig/cluster/self_ssh.py +52 -54
- machineconfig/cluster/sessions_managers/__init__.py +0 -0
- machineconfig/cluster/sessions_managers/archive/__init__.py +0 -0
- machineconfig/{jobs/python → cluster/sessions_managers/archive}/create_zellij_template.py +5 -3
- machineconfig/cluster/sessions_managers/archive/session_managers.py +184 -0
- machineconfig/cluster/sessions_managers/demo_rich_zellij.py +0 -0
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +160 -0
- machineconfig/cluster/sessions_managers/wt_local.py +494 -0
- machineconfig/cluster/sessions_managers/wt_local_manager.py +577 -0
- machineconfig/cluster/sessions_managers/wt_remote.py +288 -0
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +483 -0
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +196 -0
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +418 -0
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +175 -0
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +300 -0
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +228 -0
- machineconfig/cluster/sessions_managers/zellij_local.py +418 -0
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +533 -0
- machineconfig/cluster/sessions_managers/zellij_remote.py +229 -0
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +188 -0
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +64 -0
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +126 -0
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +334 -0
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +68 -0
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +119 -0
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +85 -0
- machineconfig/cluster/templates/cli_click.py +0 -1
- machineconfig/cluster/templates/cli_gooey.py +102 -104
- machineconfig/cluster/templates/run_cloud.py +51 -51
- machineconfig/cluster/templates/run_cluster.py +103 -59
- machineconfig/cluster/templates/run_remote.py +57 -58
- machineconfig/cluster/templates/utils.py +69 -36
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/linux/msc/lid.sh +2 -4
- machineconfig/jobs/linux/msc/network.sh +3 -6
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/check_installations.py +258 -190
- machineconfig/jobs/python/create_bootable_media.py +7 -3
- machineconfig/jobs/python/python_cargo_build_share.py +50 -50
- machineconfig/jobs/python/python_ve_symlink.py +10 -10
- machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
- machineconfig/jobs/python/vscode/api.py +3 -3
- machineconfig/jobs/python/vscode/link_ve.py +6 -6
- machineconfig/jobs/python/vscode/select_interpreter.py +13 -9
- machineconfig/jobs/python/vscode/sync_code.py +14 -11
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +5 -5
- machineconfig/jobs/python_custom_installers/dev/aider.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +7 -6
- machineconfig/jobs/python_custom_installers/dev/brave.py +11 -7
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +7 -8
- machineconfig/jobs/python_custom_installers/dev/code.py +7 -5
- machineconfig/jobs/python_custom_installers/dev/cursor.py +66 -5
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +4 -5
- machineconfig/jobs/python_custom_installers/dev/espanso.py +21 -17
- machineconfig/jobs/python_custom_installers/dev/goes.py +6 -12
- machineconfig/jobs/python_custom_installers/dev/lvim.py +7 -6
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +5 -5
- machineconfig/jobs/python_custom_installers/dev/redis.py +11 -7
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +12 -8
- machineconfig/jobs/python_custom_installers/dev/winget.py +194 -0
- machineconfig/jobs/python_custom_installers/{dev/docker.py → docker.py} +12 -7
- machineconfig/jobs/python_custom_installers/gh.py +10 -9
- machineconfig/jobs/python_custom_installers/hx.py +36 -65
- machineconfig/jobs/python_custom_installers/scripts/linux/brave.sh +4 -8
- machineconfig/jobs/python_custom_installers/scripts/linux/docker.sh +5 -10
- machineconfig/jobs/python_custom_installers/scripts/linux/docker_start.sh +3 -6
- machineconfig/jobs/python_custom_installers/scripts/linux/edge.sh +3 -6
- machineconfig/jobs/python_custom_installers/scripts/linux/nerdfont.sh +5 -10
- machineconfig/jobs/python_custom_installers/scripts/linux/pgsql.sh +4 -8
- machineconfig/jobs/python_custom_installers/scripts/linux/redis.sh +5 -10
- machineconfig/jobs/python_custom_installers/scripts/linux/timescaledb.sh +6 -12
- machineconfig/jobs/python_custom_installers/scripts/linux/vscode.sh +101 -33
- machineconfig/jobs/python_custom_installers/scripts/linux/warp-cli.sh +5 -10
- machineconfig/jobs/python_custom_installers/scripts/linux/wezterm.sh +3 -6
- machineconfig/jobs/python_custom_installers/{dev/warp-cli.py → warp-cli.py} +5 -5
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/config.json +133 -9
- machineconfig/jobs/python_generic_installers/dev/config.json +208 -37
- machineconfig/jobs/python_generic_installers/update.py +3 -0
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_linux_installers/config.json +42 -6
- machineconfig/jobs/python_linux_installers/dev/config.json +79 -11
- machineconfig/jobs/python_windows_installers/config.json +6 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/profile/create.py +5 -5
- machineconfig/profile/create_hardlinks.py +5 -5
- machineconfig/profile/shell.py +69 -63
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/cloud/init.sh +9 -18
- machineconfig/scripts/linux/fire +5 -24
- machineconfig/scripts/linux/fire_agents +27 -0
- machineconfig/scripts/linux/share_cloud.sh +6 -12
- machineconfig/scripts/linux/wifi_conn +24 -0
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/archive/im2text.py +28 -30
- machineconfig/scripts/python/archive/tmate_conn.py +10 -13
- machineconfig/scripts/python/archive/tmate_start.py +12 -16
- machineconfig/scripts/python/choose_wezterm_theme.py +12 -21
- machineconfig/scripts/python/cloud_copy.py +49 -104
- machineconfig/scripts/python/cloud_manager.py +77 -91
- machineconfig/scripts/python/cloud_mount.py +36 -46
- machineconfig/scripts/python/cloud_repo_sync.py +33 -79
- machineconfig/scripts/python/cloud_sync.py +35 -45
- machineconfig/scripts/python/croshell.py +70 -92
- machineconfig/scripts/python/devops.py +54 -113
- machineconfig/scripts/python/devops_add_identity.py +71 -109
- machineconfig/scripts/python/devops_add_ssh_key.py +42 -149
- machineconfig/scripts/python/devops_backup_retrieve.py +31 -119
- machineconfig/scripts/python/devops_devapps_install.py +6 -10
- machineconfig/scripts/python/devops_update_repos.py +5 -4
- machineconfig/scripts/python/dotfile.py +10 -7
- machineconfig/scripts/python/fire_agents.py +69 -0
- machineconfig/scripts/python/fire_jobs.py +117 -78
- machineconfig/scripts/python/ftpx.py +8 -8
- machineconfig/scripts/python/get_zellij_cmd.py +3 -3
- machineconfig/scripts/python/gh_models.py +6 -4
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/cloud_helpers.py +49 -46
- machineconfig/scripts/python/helpers/helpers2.py +26 -39
- machineconfig/scripts/python/helpers/helpers4.py +23 -35
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +33 -67
- machineconfig/scripts/python/mount_nfs.py +8 -11
- machineconfig/scripts/python/mount_nw_drive.py +4 -4
- machineconfig/scripts/python/mount_ssh.py +2 -2
- machineconfig/scripts/python/onetimeshare.py +56 -57
- machineconfig/scripts/python/pomodoro.py +55 -55
- machineconfig/scripts/python/repos.py +72 -49
- machineconfig/scripts/python/scheduler.py +70 -53
- machineconfig/scripts/python/snapshot.py +21 -24
- machineconfig/scripts/python/start_slidev.py +6 -5
- machineconfig/scripts/python/start_terminals.py +3 -1
- machineconfig/scripts/python/viewer.py +5 -4
- machineconfig/scripts/python/viewer_template.py +138 -140
- machineconfig/scripts/python/wifi_conn.py +416 -62
- machineconfig/scripts/python/wsl_windows_transfer.py +18 -3
- machineconfig/scripts/windows/fire.ps1 +27 -15
- machineconfig/settings/linters/.pylintrc +6 -7
- machineconfig/settings/lvim/windows/config.lua +0 -0
- machineconfig/settings/shells/bash/init.sh +6 -0
- machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +7 -6
- machineconfig/settings/shells/pwsh/init.ps1 +6 -6
- machineconfig/settings/shells/wt/settings.json +51 -266
- machineconfig/setup_linux/nix/cli_installation.sh +9 -18
- machineconfig/setup_linux/others/openssh-server_add_pub_key.sh +3 -6
- machineconfig/setup_linux/web_shortcuts/all.sh +5 -10
- machineconfig/setup_linux/web_shortcuts/ascii_art.sh +7 -14
- machineconfig/setup_linux/web_shortcuts/croshell.sh +6 -12
- machineconfig/setup_linux/web_shortcuts/interactive.sh +39 -70
- machineconfig/setup_linux/web_shortcuts/ssh.sh +8 -16
- machineconfig/setup_linux/web_shortcuts/update_system.sh +7 -14
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +3 -6
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +27 -21
- machineconfig/utils/ai/browser_user_wrapper.py +60 -45
- machineconfig/utils/ai/generate_file_checklist.py +4 -7
- machineconfig/utils/ai/url2md.py +15 -7
- machineconfig/utils/cloud/onedrive/setup_oauth.py +59 -0
- machineconfig/utils/cloud/onedrive/transaction.py +796 -0
- machineconfig/utils/{utils_code.py → code.py} +25 -22
- machineconfig/utils/installer.py +81 -44
- machineconfig/utils/installer_utils/installer_abc.py +7 -6
- machineconfig/utils/installer_utils/installer_class.py +44 -25
- machineconfig/utils/io_save.py +107 -0
- machineconfig/utils/{utils_links.py → links.py} +28 -35
- machineconfig/utils/{utils_options.py → options.py} +14 -28
- machineconfig/utils/path.py +112 -0
- machineconfig/utils/path_reduced.py +608 -0
- machineconfig/utils/procs.py +134 -73
- machineconfig/utils/scheduling.py +312 -222
- machineconfig/utils/utils.py +19 -26
- machineconfig/utils/utils2.py +42 -0
- machineconfig/utils/utils5.py +84 -0
- machineconfig/utils/ve.py +49 -103
- {machineconfig-1.94.dist-info → machineconfig-1.96.dist-info}/METADATA +5 -3
- machineconfig-1.96.dist-info/RECORD +437 -0
- {machineconfig-1.94.dist-info → machineconfig-1.96.dist-info}/WHEEL +1 -1
- machineconfig/cluster/session_managers.py +0 -183
- machineconfig/cluster/templates/f.py +0 -4
- machineconfig/jobs/python/__pycache__/check_installations.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/checkout_version.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
- machineconfig/jobs/python/checkout_version.py +0 -123
- machineconfig/jobs/python/vscode/__pycache__/api.cpython-311.pyc +0 -0
- machineconfig/jobs/python/vscode/__pycache__/link_ve.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/__pycache__/hx.cpython-311.pyc +0 -0
- machineconfig/jobs/python_windows_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/.mypy_cache/.gitignore +0 -2
- machineconfig/scripts/python/.mypy_cache/3.11/@plugins_snapshot.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/__future__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/__future__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_ast.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_ast.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_bz2.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_bz2.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_codecs.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_codecs.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_collections_abc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_collections_abc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_compression.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_compression.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_decimal.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_decimal.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_frozen_importlib.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_frozen_importlib.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_frozen_importlib_external.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_frozen_importlib_external.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_io.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_io.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_locale.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_locale.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_stat.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_stat.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_struct.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_struct.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_thread.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_thread.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_typeshed/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_typeshed/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_typeshed/importlib.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_typeshed/importlib.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_warnings.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_warnings.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_weakref.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_weakref.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_weakrefset.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/_weakrefset.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/abc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/abc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/argparse.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/argparse.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/ast.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/ast.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/binascii.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/binascii.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/builtins.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/builtins.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/bz2.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/bz2.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/calendar.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/calendar.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/codecs.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/codecs.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/collections/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/collections/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/collections/abc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/collections/abc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/configparser.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/configparser.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/contextlib.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/contextlib.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/dataclasses.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/dataclasses.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/datetime.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/datetime.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/decimal.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/decimal.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/dis.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/dis.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/_policybase.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/_policybase.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/charset.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/charset.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/contentmanager.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/contentmanager.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/errors.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/errors.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/header.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/header.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/message.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/message.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/policy.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/email/policy.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/enum.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/enum.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/fnmatch.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/fnmatch.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/functools.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/functools.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/gc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/gc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/genericpath.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/genericpath.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/getpass.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/getpass.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/cmd.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/cmd.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/compat.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/compat.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/config.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/config.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/db.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/db.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/diff.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/diff.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/exc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/exc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/base.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/base.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/fun.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/fun.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/typ.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/typ.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/util.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/index/util.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/base.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/base.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/blob.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/blob.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/commit.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/commit.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/fun.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/fun.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/base.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/base.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/root.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/root.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/util.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/submodule/util.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/tag.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/tag.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/tree.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/tree.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/util.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/objects/util.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/head.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/head.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/log.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/log.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/reference.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/reference.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/remote.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/remote.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/symbolic.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/symbolic.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/tag.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/refs/tag.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/remote.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/remote.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/repo/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/repo/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/repo/base.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/repo/base.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/repo/fun.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/repo/fun.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/types.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/types.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/util.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/git/util.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/glob.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/glob.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/gzip.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/gzip.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/_abc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/_abc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/_bootstrap.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/_bootstrap.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/_bootstrap_external.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/_bootstrap_external.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/abc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/abc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/machinery.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/machinery.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/metadata/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/metadata/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/metadata/_meta.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/metadata/_meta.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/readers.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/readers.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/resources/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/resources/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/resources/_common.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/resources/_common.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/resources/abc.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/importlib/resources/abc.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/inspect.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/inspect.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/io.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/io.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/itertools.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/itertools.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/locale.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/locale.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/logging/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/logging/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/mimetypes.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/mimetypes.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/mmap.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/mmap.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/numbers.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/numbers.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/opcode.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/opcode.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/os/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/os/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/os/path.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/os/path.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/pathlib.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/pathlib.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/platform.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/platform.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/posixpath.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/posixpath.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/re.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/re.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/resource.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/resource.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/shlex.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/shlex.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/shutil.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/shutil.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/signal.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/signal.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/machineconfig/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/machineconfig/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/machineconfig/scripts/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/machineconfig/scripts/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/machineconfig/scripts/python/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/src/machineconfig/scripts/python/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sre_compile.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sre_compile.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sre_constants.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sre_constants.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sre_parse.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sre_parse.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/stat.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/stat.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/string.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/string.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/struct.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/struct.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/subprocess.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/subprocess.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sys/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/sys/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/tarfile.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/tarfile.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/tempfile.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/tempfile.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/textwrap.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/textwrap.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/threading.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/threading.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/time.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/time.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/types.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/types.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/typing.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/typing.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/typing_extensions.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/typing_extensions.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/urllib/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/urllib/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/urllib/parse.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/urllib/parse.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/uuid.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/uuid.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/warnings.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/warnings.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/weakref.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/weakref.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/zipfile/__init__.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/zipfile/__init__.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/zlib.data.json +0 -1
- machineconfig/scripts/python/.mypy_cache/3.11/zlib.meta.json +0 -1
- machineconfig/scripts/python/.mypy_cache/CACHEDIR.TAG +0 -3
- machineconfig/scripts/python/__pycache__/cloud_repo_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/gh_models.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/url2md.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/viewer.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/vscode_api.cpython-311.pyc +0 -0
- machineconfig/settings/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/settings/linters/.ruff_cache/.gitignore +0 -2
- machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +0 -1
- machineconfig/settings/shells/ipy/profiles/default/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/playext.cpython-311.pyc +0 -0
- machineconfig/utils/utils_path.py +0 -151
- machineconfig/utils/ve_utils/ve1.py +0 -111
- machineconfig/utils/ve_utils/ve2.py +0 -142
- machineconfig-1.94.dist-info/RECORD +0 -710
- {machineconfig-1.94.dist-info → machineconfig-1.96.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from typing import Dict, Tuple, Optional, List, Union, Any
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import logging
|
|
5
|
+
import json
|
|
6
|
+
import uuid
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
|
|
9
|
+
from rich.console import Console
|
|
10
|
+
|
|
11
|
+
from machineconfig.cluster.sessions_managers.zellij_utils.remote_executor import RemoteExecutor
|
|
12
|
+
from machineconfig.cluster.sessions_managers.zellij_utils.layout_generator import LayoutGenerator
|
|
13
|
+
from machineconfig.cluster.sessions_managers.zellij_utils.process_monitor import ProcessMonitor
|
|
14
|
+
from machineconfig.cluster.sessions_managers.zellij_utils.session_manager import SessionManager
|
|
15
|
+
from machineconfig.cluster.sessions_managers.zellij_utils.status_reporter import StatusReporter
|
|
16
|
+
|
|
17
|
+
logging.basicConfig(level=logging.INFO)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
console = Console()
|
|
20
|
+
TMP_LAYOUT_DIR = Path.home().joinpath("tmp_results", "zellij_layouts", "layout_manager")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ZellijRemoteLayoutGenerator:
|
|
24
|
+
|
|
25
|
+
def __init__(self, remote_name: str, session_name_prefix: str):
|
|
26
|
+
self.remote_name = remote_name
|
|
27
|
+
self.session_name = session_name_prefix + "_" + LayoutGenerator.generate_random_suffix()
|
|
28
|
+
self.tab_config: Dict[str, Tuple[str, str]] = {}
|
|
29
|
+
self.layout_path: Optional[str] = None
|
|
30
|
+
|
|
31
|
+
# Initialize modular components
|
|
32
|
+
self.remote_executor = RemoteExecutor(remote_name)
|
|
33
|
+
self.layout_generator = LayoutGenerator()
|
|
34
|
+
self.process_monitor = ProcessMonitor(self.remote_executor)
|
|
35
|
+
self.session_manager = SessionManager(self.remote_executor, self.session_name, TMP_LAYOUT_DIR)
|
|
36
|
+
self.status_reporter = StatusReporter(self.process_monitor, self.session_manager)
|
|
37
|
+
|
|
38
|
+
def copy_layout_to_remote(self, local_layout_file: Path, random_suffix: str) -> str:
|
|
39
|
+
return self.session_manager.copy_layout_to_remote(local_layout_file, random_suffix)
|
|
40
|
+
|
|
41
|
+
def create_zellij_layout(self, tab_config: Dict[str, Tuple[str, str]], output_dir: Optional[str] = None) -> str:
|
|
42
|
+
# Enhanced Rich logging for remote layout creation
|
|
43
|
+
tab_count = len(tab_config)
|
|
44
|
+
console.print(f"[bold cyan]📋 Creating Zellij layout[/bold cyan] [bright_green]with {tab_count} tabs[/bright_green] [magenta]for remote[/magenta] [bold yellow]'{self.remote_name}'[/bold yellow]")
|
|
45
|
+
|
|
46
|
+
# Display tab summary for remote
|
|
47
|
+
for tab_name, (cwd, _) in tab_config.items():
|
|
48
|
+
console.print(f" [yellow]→[/yellow] [bold]{tab_name}[/bold] [dim]in[/dim] [blue]{cwd}[/blue] [dim]on[/dim] [yellow]{self.remote_name}[/yellow]")
|
|
49
|
+
|
|
50
|
+
self.tab_config = tab_config.copy()
|
|
51
|
+
if output_dir:
|
|
52
|
+
output_path = Path(output_dir)
|
|
53
|
+
else:
|
|
54
|
+
output_path = TMP_LAYOUT_DIR
|
|
55
|
+
self.layout_path = self.layout_generator.create_layout_file(tab_config, output_path, self.session_name)
|
|
56
|
+
return self.layout_path
|
|
57
|
+
|
|
58
|
+
def get_layout_preview(self, tab_config: Dict[str, Tuple[str, str]]) -> str:
|
|
59
|
+
return self.layout_generator.generate_layout_content(tab_config)
|
|
60
|
+
|
|
61
|
+
def check_command_status(self, tab_name: str, use_verification: bool = True) -> Dict[str, Any]:
|
|
62
|
+
return self.process_monitor.check_command_status(tab_name, self.tab_config, use_verification)
|
|
63
|
+
|
|
64
|
+
def check_all_commands_status(self) -> Dict[str, Dict[str, Any]]:
|
|
65
|
+
return self.process_monitor.check_all_commands_status(self.tab_config)
|
|
66
|
+
|
|
67
|
+
def check_zellij_session_status(self) -> Dict[str, Any]:
|
|
68
|
+
return self.session_manager.check_zellij_session_status()
|
|
69
|
+
|
|
70
|
+
def get_comprehensive_status(self) -> Dict[str, Any]:
|
|
71
|
+
return self.status_reporter.get_comprehensive_status(self.tab_config)
|
|
72
|
+
|
|
73
|
+
def print_status_report(self) -> None:
|
|
74
|
+
self.status_reporter.print_status_report(self.tab_config)
|
|
75
|
+
|
|
76
|
+
def start_zellij_session(self, layout_file_path: Optional[str] = None) -> Dict[str, Any]:
|
|
77
|
+
return self.session_manager.start_zellij_session(layout_file_path or self.layout_path)
|
|
78
|
+
|
|
79
|
+
def attach_to_session(self) -> None:
|
|
80
|
+
self.session_manager.attach_to_session()
|
|
81
|
+
|
|
82
|
+
# Legacy methods for backward compatibility
|
|
83
|
+
def force_fresh_process_check(self, tab_name: str) -> Dict[str, Any]:
|
|
84
|
+
return self.process_monitor.force_fresh_process_check(tab_name, self.tab_config)
|
|
85
|
+
|
|
86
|
+
def verify_process_alive(self, pid: int) -> bool:
|
|
87
|
+
return self.process_monitor.verify_process_alive(pid)
|
|
88
|
+
|
|
89
|
+
def get_verified_process_status(self, tab_name: str) -> Dict[str, Any]:
|
|
90
|
+
return self.process_monitor.get_verified_process_status(tab_name, self.tab_config)
|
|
91
|
+
|
|
92
|
+
# Static methods for backward compatibility
|
|
93
|
+
@staticmethod
|
|
94
|
+
def run_remote_command(remote_name: str, command: str, timeout: int = 30):
|
|
95
|
+
executor = RemoteExecutor(remote_name)
|
|
96
|
+
return executor.run_command(command, timeout)
|
|
97
|
+
|
|
98
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
99
|
+
return {
|
|
100
|
+
"remote_name": self.remote_name,
|
|
101
|
+
"session_name": self.session_name,
|
|
102
|
+
"tab_config": self.tab_config,
|
|
103
|
+
"layout_path": self.layout_path,
|
|
104
|
+
"created_at": datetime.now().isoformat(),
|
|
105
|
+
"class_name": self.__class__.__name__
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
def to_json(self, file_path: Optional[Union[str, Path]] = None) -> str:
|
|
109
|
+
# Generate file path if not provided
|
|
110
|
+
if file_path is None:
|
|
111
|
+
random_id = str(uuid.uuid4())[:8]
|
|
112
|
+
default_dir = Path.home() / "tmp_results" / "zellij_sessions" / "serialized"
|
|
113
|
+
default_dir.mkdir(parents=True, exist_ok=True)
|
|
114
|
+
file_path_obj = default_dir / f"zellij_session_{random_id}.json"
|
|
115
|
+
else:
|
|
116
|
+
file_path_obj = Path(file_path)
|
|
117
|
+
|
|
118
|
+
# Ensure .json extension
|
|
119
|
+
if not str(file_path_obj).endswith('.json'):
|
|
120
|
+
file_path_obj = file_path_obj.with_suffix('.json')
|
|
121
|
+
|
|
122
|
+
# Ensure parent directory exists
|
|
123
|
+
file_path_obj.parent.mkdir(parents=True, exist_ok=True)
|
|
124
|
+
|
|
125
|
+
# Serialize to JSON
|
|
126
|
+
data = self.to_dict()
|
|
127
|
+
|
|
128
|
+
with open(file_path_obj, 'w', encoding='utf-8') as f:
|
|
129
|
+
json.dump(data, f, indent=2, ensure_ascii=False)
|
|
130
|
+
|
|
131
|
+
logger.info(f"✅ Serialized ZellijRemoteLayoutGenerator to: {file_path_obj}")
|
|
132
|
+
return str(file_path_obj)
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_json(cls, file_path: Union[str, Path]) -> 'ZellijRemoteLayoutGenerator':
|
|
136
|
+
file_path = Path(file_path)
|
|
137
|
+
|
|
138
|
+
# Ensure .json extension
|
|
139
|
+
if not str(file_path).endswith('.json'):
|
|
140
|
+
file_path = file_path.with_suffix('.json')
|
|
141
|
+
|
|
142
|
+
if not file_path.exists():
|
|
143
|
+
raise FileNotFoundError(f"JSON file not found: {file_path}")
|
|
144
|
+
|
|
145
|
+
# Load JSON data
|
|
146
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
147
|
+
data = json.load(f)
|
|
148
|
+
|
|
149
|
+
# Validate that it's the correct class
|
|
150
|
+
if data.get('class_name') != cls.__name__:
|
|
151
|
+
logger.warning(f"Class name mismatch: expected {cls.__name__}, got {data.get('class_name')}")
|
|
152
|
+
|
|
153
|
+
# Create new instance
|
|
154
|
+
# Extract session name prefix by removing the suffix
|
|
155
|
+
session_name = data['session_name']
|
|
156
|
+
if '_' in session_name:
|
|
157
|
+
session_name_prefix = '_'.join(session_name.split('_')[:-1])
|
|
158
|
+
else:
|
|
159
|
+
session_name_prefix = session_name
|
|
160
|
+
|
|
161
|
+
instance = cls(remote_name=data['remote_name'], session_name_prefix=session_name_prefix)
|
|
162
|
+
|
|
163
|
+
# Restore state
|
|
164
|
+
instance.session_name = data['session_name']
|
|
165
|
+
instance.tab_config = data['tab_config']
|
|
166
|
+
instance.layout_path = data['layout_path']
|
|
167
|
+
|
|
168
|
+
logger.info(f"✅ Loaded ZellijRemoteLayoutGenerator from: {file_path}")
|
|
169
|
+
return instance
|
|
170
|
+
|
|
171
|
+
@staticmethod
|
|
172
|
+
def list_saved_sessions(directory_path: Optional[Union[str, Path]] = None) -> List[str]:
|
|
173
|
+
if directory_path is None:
|
|
174
|
+
directory_path = Path.home() / "tmp_results" / "zellij_sessions" / "serialized"
|
|
175
|
+
else:
|
|
176
|
+
directory_path = Path(directory_path)
|
|
177
|
+
|
|
178
|
+
if not directory_path.exists():
|
|
179
|
+
return []
|
|
180
|
+
|
|
181
|
+
json_files = [f.name for f in directory_path.glob("*.json")]
|
|
182
|
+
return sorted(json_files)
|
|
183
|
+
|
|
184
|
+
if __name__ == "__main__":
|
|
185
|
+
# Example usage
|
|
186
|
+
sample_tabs = {
|
|
187
|
+
"🤖Bot1": ("~/code/bytesense/bithence", "~/scripts/fire -mO go1.py bot1 --kw create_new_bot True"),
|
|
188
|
+
"🤖Bot2": ("~/code/bytesense/bithence", "~/scripts/fire -mO go2.py bot2 --kw create_new_bot True"),
|
|
189
|
+
"📊Monitor": ("~", "htop"),
|
|
190
|
+
"📝Logs": ("/var/log", "tail -f /var/log/app.log")
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
# Replace 'myserver' with an actual SSH config alias
|
|
194
|
+
remote_name = "myserver" # This should be in ~/.ssh/config
|
|
195
|
+
session_name = "test_remote_session"
|
|
196
|
+
|
|
197
|
+
try:
|
|
198
|
+
# Create layout using the remote generator
|
|
199
|
+
generator = ZellijRemoteLayoutGenerator(remote_name=remote_name, session_name_prefix=session_name)
|
|
200
|
+
layout_path = generator.create_zellij_layout(sample_tabs)
|
|
201
|
+
print(f"✅ Remote layout created successfully: {layout_path}")
|
|
202
|
+
|
|
203
|
+
# Demonstrate serialization
|
|
204
|
+
print("\n💾 Demonstrating serialization...")
|
|
205
|
+
saved_path = generator.to_json()
|
|
206
|
+
print(f"✅ Session saved to: {saved_path}")
|
|
207
|
+
|
|
208
|
+
# List all saved sessions
|
|
209
|
+
saved_sessions = ZellijRemoteLayoutGenerator.list_saved_sessions()
|
|
210
|
+
print(f"📋 Available saved sessions: {saved_sessions}")
|
|
211
|
+
|
|
212
|
+
# Demonstrate loading (using the full path)
|
|
213
|
+
loaded_generator = ZellijRemoteLayoutGenerator.from_json(saved_path)
|
|
214
|
+
print(f"✅ Session loaded successfully: {loaded_generator.session_name}")
|
|
215
|
+
print(f"📊 Loaded tabs: {list(loaded_generator.tab_config.keys())}")
|
|
216
|
+
|
|
217
|
+
# Demonstrate status checking
|
|
218
|
+
print(f"\n🔍 Checking command status on remote '{remote_name}':")
|
|
219
|
+
generator.print_status_report()
|
|
220
|
+
|
|
221
|
+
# Start the session (uncomment to actually start)
|
|
222
|
+
# start_result = generator.start_zellij_session()
|
|
223
|
+
# print(f"Session start result: {start_result}")
|
|
224
|
+
|
|
225
|
+
# Attach to session (uncomment to attach)
|
|
226
|
+
# generator.attach_to_session()
|
|
227
|
+
|
|
228
|
+
except Exception as e:
|
|
229
|
+
print(f"❌ Error: {e}")
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
import json
|
|
3
|
+
import uuid
|
|
4
|
+
import logging
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from machineconfig.utils.utils5 import Scheduler
|
|
8
|
+
from machineconfig.cluster.sessions_managers.zellij_local import run_command_in_zellij_tab
|
|
9
|
+
from machineconfig.cluster.sessions_managers.zellij_remote import ZellijRemoteLayoutGenerator
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
TMP_SERIALIAZATION_DIR = Path.home().joinpath("tmp_results", "session_manager", "zellij", "remote_manager")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ZellijSessionManager:
|
|
16
|
+
def __init__(self, machine2zellij_tabs: dict[str, dict[str, tuple[str, str]]], session_name_prefix: str = "JobMgr"):
|
|
17
|
+
self.session_name_prefix = session_name_prefix
|
|
18
|
+
self.machine2zellij_tabs = machine2zellij_tabs # Store the original config
|
|
19
|
+
self.managers: list[ZellijRemoteLayoutGenerator] = []
|
|
20
|
+
for machine, tab_config in machine2zellij_tabs.items():
|
|
21
|
+
an_m = ZellijRemoteLayoutGenerator(remote_name=machine, session_name_prefix=self.session_name_prefix)
|
|
22
|
+
an_m.create_zellij_layout(tab_config=tab_config)
|
|
23
|
+
self.managers.append(an_m)
|
|
24
|
+
|
|
25
|
+
def ssh_to_all_machines(self) -> str:
|
|
26
|
+
hostname2zellij_session = {}
|
|
27
|
+
for an_m in self.managers:
|
|
28
|
+
hostname = an_m.remote_name
|
|
29
|
+
session_name = an_m.session_name
|
|
30
|
+
hostname2zellij_session[hostname] = session_name
|
|
31
|
+
cmds = ""
|
|
32
|
+
for hostname, session_name in hostname2zellij_session.items():
|
|
33
|
+
# ssh hpc-node024 -t "zellij attach JobMgrd074muex"
|
|
34
|
+
ssh_cmd = f"ssh {hostname} -t 'zellij attach {session_name}'"
|
|
35
|
+
a_cmd = run_command_in_zellij_tab(command=ssh_cmd, tab_name=hostname, cwd=None)
|
|
36
|
+
cmds += a_cmd + "\n"
|
|
37
|
+
return cmds
|
|
38
|
+
|
|
39
|
+
def kill_all_sessions(self) -> None:
|
|
40
|
+
for an_m in self.managers:
|
|
41
|
+
ZellijRemoteLayoutGenerator.run_remote_command(
|
|
42
|
+
remote_name=an_m.remote_name,
|
|
43
|
+
command="zellij kill-all-sessions --yes"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def start_zellij_sessions(self) -> None:
|
|
47
|
+
for an_m in self.managers:
|
|
48
|
+
an_m.start_zellij_session()
|
|
49
|
+
|
|
50
|
+
def run_monitoring_routine(self) -> None:
|
|
51
|
+
def routine(scheduler: Scheduler):
|
|
52
|
+
if scheduler.cycle % 2 == 0:
|
|
53
|
+
statuses = []
|
|
54
|
+
for _idx, an_m in enumerate(self.managers):
|
|
55
|
+
a_status = an_m.check_all_commands_status()
|
|
56
|
+
statuses.append(a_status)
|
|
57
|
+
keys = []
|
|
58
|
+
for item in statuses:
|
|
59
|
+
keys.extend(item.keys())
|
|
60
|
+
values = []
|
|
61
|
+
for item in statuses:
|
|
62
|
+
values.extend(item.values())
|
|
63
|
+
# Create list of dictionaries instead of DataFrame
|
|
64
|
+
status_data = []
|
|
65
|
+
for i, key in enumerate(keys):
|
|
66
|
+
if i < len(values):
|
|
67
|
+
status_data.append({"tabName": key, "status": values[i]})
|
|
68
|
+
|
|
69
|
+
# Check if all stopped
|
|
70
|
+
running_count = sum(1 for item in status_data if item.get("status", {}).get("running", False))
|
|
71
|
+
if running_count == 0: # they all stopped
|
|
72
|
+
sched.max_cycles = sched.cycle # stop the scheduler from calling this routine again
|
|
73
|
+
|
|
74
|
+
# Print status
|
|
75
|
+
for item in status_data:
|
|
76
|
+
print(f"Tab: {item['tabName']}, Status: {item['status']}")
|
|
77
|
+
else:
|
|
78
|
+
statuses = []
|
|
79
|
+
for _idx, an_m in enumerate(self.managers):
|
|
80
|
+
a_status = an_m.check_zellij_session_status()
|
|
81
|
+
statuses.append(a_status)
|
|
82
|
+
|
|
83
|
+
# Print statuses
|
|
84
|
+
for i, status in enumerate(statuses):
|
|
85
|
+
print(f"Manager {i}: {status}")
|
|
86
|
+
sched = Scheduler(routine=routine, wait_ms=60000) # 60 seconds
|
|
87
|
+
sched.run()
|
|
88
|
+
|
|
89
|
+
def save(self, session_id: Optional[str] = None) -> str:
|
|
90
|
+
if session_id is None:
|
|
91
|
+
session_id = str(uuid.uuid4())[:8]
|
|
92
|
+
|
|
93
|
+
# Create session directory
|
|
94
|
+
session_dir = TMP_SERIALIAZATION_DIR / session_id
|
|
95
|
+
session_dir.mkdir(parents=True, exist_ok=True)
|
|
96
|
+
|
|
97
|
+
# Save the machine2zellij_tabs configuration
|
|
98
|
+
config_file = session_dir / "machine2zellij_tabs.json"
|
|
99
|
+
with open(config_file, 'w', encoding='utf-8') as f:
|
|
100
|
+
json.dump(self.machine2zellij_tabs, f, indent=2, ensure_ascii=False)
|
|
101
|
+
|
|
102
|
+
# Save session metadata
|
|
103
|
+
metadata = {
|
|
104
|
+
"session_name_prefix": self.session_name_prefix,
|
|
105
|
+
"created_at": str(datetime.now()),
|
|
106
|
+
"num_managers": len(self.managers),
|
|
107
|
+
"machines": list(self.machine2zellij_tabs.keys())
|
|
108
|
+
}
|
|
109
|
+
metadata_file = session_dir / "metadata.json"
|
|
110
|
+
with open(metadata_file, 'w', encoding='utf-8') as f:
|
|
111
|
+
json.dump(metadata, f, indent=2, ensure_ascii=False)
|
|
112
|
+
|
|
113
|
+
# Save each ZellijRemoteLayoutGenerator
|
|
114
|
+
managers_dir = session_dir / "managers"
|
|
115
|
+
managers_dir.mkdir(exist_ok=True)
|
|
116
|
+
|
|
117
|
+
for i, manager in enumerate(self.managers):
|
|
118
|
+
manager_file = managers_dir / f"manager_{i}_{manager.remote_name}.json"
|
|
119
|
+
manager.to_json(str(manager_file))
|
|
120
|
+
|
|
121
|
+
logging.info(f"✅ Saved ZellijSessionManager session to: {session_dir}")
|
|
122
|
+
return session_id
|
|
123
|
+
|
|
124
|
+
@classmethod
|
|
125
|
+
def load(cls, session_id: str) -> 'ZellijSessionManager':
|
|
126
|
+
session_dir = TMP_SERIALIAZATION_DIR / session_id
|
|
127
|
+
|
|
128
|
+
if not session_dir.exists():
|
|
129
|
+
raise FileNotFoundError(f"Session directory not found: {session_dir}")
|
|
130
|
+
config_file = session_dir / "machine2zellij_tabs.json"
|
|
131
|
+
if not config_file.exists():
|
|
132
|
+
raise FileNotFoundError(f"Configuration file not found: {config_file}")
|
|
133
|
+
with open(config_file, 'r', encoding='utf-8') as f:
|
|
134
|
+
machine2zellij_tabs = json.load(f)
|
|
135
|
+
|
|
136
|
+
# Load metadata
|
|
137
|
+
metadata_file = session_dir / "metadata.json"
|
|
138
|
+
session_name_prefix = "JobMgr" # default fallback
|
|
139
|
+
if metadata_file.exists():
|
|
140
|
+
with open(metadata_file, 'r', encoding='utf-8') as f:
|
|
141
|
+
metadata = json.load(f)
|
|
142
|
+
session_name_prefix = metadata.get("session_name_prefix", "JobMgr")
|
|
143
|
+
# Create new instance (this will create new managers)
|
|
144
|
+
instance = cls(machine2zellij_tabs=machine2zellij_tabs, session_name_prefix=session_name_prefix)
|
|
145
|
+
# Load saved managers to restore their states
|
|
146
|
+
managers_dir = session_dir / "managers"
|
|
147
|
+
if managers_dir.exists():
|
|
148
|
+
# Clear the auto-created managers and load the saved ones
|
|
149
|
+
instance.managers = []
|
|
150
|
+
# Get all manager files and sort them
|
|
151
|
+
manager_files = sorted(managers_dir.glob("manager_*.json"))
|
|
152
|
+
for manager_file in manager_files:
|
|
153
|
+
try:
|
|
154
|
+
loaded_manager = ZellijRemoteLayoutGenerator.from_json(str(manager_file))
|
|
155
|
+
instance.managers.append(loaded_manager)
|
|
156
|
+
except Exception as e:
|
|
157
|
+
logging.warning(f"Failed to load manager from {manager_file}: {e}")
|
|
158
|
+
logging.info(f"✅ Loaded ZellijSessionManager session from: {session_dir}")
|
|
159
|
+
return instance
|
|
160
|
+
|
|
161
|
+
@staticmethod
|
|
162
|
+
def list_saved_sessions() -> list[str]:
|
|
163
|
+
if not TMP_SERIALIAZATION_DIR.exists():
|
|
164
|
+
return []
|
|
165
|
+
|
|
166
|
+
sessions = []
|
|
167
|
+
for item in TMP_SERIALIAZATION_DIR.iterdir():
|
|
168
|
+
if item.is_dir() and (item / "metadata.json").exists():
|
|
169
|
+
sessions.append(item.name)
|
|
170
|
+
|
|
171
|
+
return sorted(sessions)
|
|
172
|
+
|
|
173
|
+
@staticmethod
|
|
174
|
+
def delete_session(session_id: str) -> bool:
|
|
175
|
+
session_dir = TMP_SERIALIAZATION_DIR / session_id
|
|
176
|
+
|
|
177
|
+
if not session_dir.exists():
|
|
178
|
+
logging.warning(f"Session directory not found: {session_dir}")
|
|
179
|
+
return False
|
|
180
|
+
|
|
181
|
+
try:
|
|
182
|
+
import shutil
|
|
183
|
+
shutil.rmtree(session_dir)
|
|
184
|
+
logging.info(f"✅ Deleted session: {session_id}")
|
|
185
|
+
return True
|
|
186
|
+
except Exception as e:
|
|
187
|
+
logging.error(f"Failed to delete session {session_id}: {e}")
|
|
188
|
+
return False
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Example usage of the modularized Zellij remote layout generator.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from machineconfig.cluster.sessions_managers.zellij_remote import ZellijRemoteLayoutGenerator
|
|
7
|
+
|
|
8
|
+
def example_usage():
|
|
9
|
+
"""Demonstrate the refactored modular usage."""
|
|
10
|
+
|
|
11
|
+
# Sample tab configuration
|
|
12
|
+
sample_tabs = {
|
|
13
|
+
"🤖Bot1": ("~/code/bytesense/bithence", "~/scripts/fire -mO go1.py bot1 --kw create_new_bot True"),
|
|
14
|
+
"🤖Bot2": ("~/code/bytesense/bithence", "~/scripts/fire -mO go2.py bot2 --kw create_new_bot True"),
|
|
15
|
+
"📊Monitor": ("~", "htop"),
|
|
16
|
+
"📝Logs": ("/var/log", "tail -f /var/log/app.log")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# Replace 'myserver' with an actual SSH config alias
|
|
20
|
+
remote_name = "myserver" # This should be in ~/.ssh/config
|
|
21
|
+
session_name = "test_remote_session"
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
# Create layout using the remote generator
|
|
25
|
+
generator = ZellijRemoteLayoutGenerator(remote_name=remote_name, session_name_prefix=session_name)
|
|
26
|
+
|
|
27
|
+
# Create layout file
|
|
28
|
+
layout_path = generator.create_zellij_layout(sample_tabs)
|
|
29
|
+
print(f"✅ Remote layout created successfully: {layout_path}")
|
|
30
|
+
|
|
31
|
+
# Preview the layout content
|
|
32
|
+
preview = generator.get_layout_preview(sample_tabs)
|
|
33
|
+
print(f"📄 Layout preview:\n{preview}")
|
|
34
|
+
|
|
35
|
+
# Check status using the modular components
|
|
36
|
+
print(f"\n🔍 Checking command status on remote '{remote_name}':")
|
|
37
|
+
generator.print_status_report()
|
|
38
|
+
|
|
39
|
+
# The individual components can also be used directly:
|
|
40
|
+
print(f"\n🔧 Direct component usage examples:")
|
|
41
|
+
|
|
42
|
+
# Use remote executor directly
|
|
43
|
+
print(f"Remote executor: {generator.remote_executor.remote_name}")
|
|
44
|
+
|
|
45
|
+
# Use layout generator directly
|
|
46
|
+
layout_content = generator.layout_generator.generate_layout_content(sample_tabs)
|
|
47
|
+
print(f"Layout content length: {len(layout_content)} characters")
|
|
48
|
+
|
|
49
|
+
# Use process monitor directly
|
|
50
|
+
status = generator.process_monitor.check_all_commands_status(sample_tabs)
|
|
51
|
+
print(f"Command status check completed for {len(status)} commands")
|
|
52
|
+
|
|
53
|
+
print("\n✅ All modular components working correctly!")
|
|
54
|
+
|
|
55
|
+
# Uncomment these to actually start and attach to the session:
|
|
56
|
+
# start_result = generator.start_zellij_session()
|
|
57
|
+
# print(f"Session start result: {start_result}")
|
|
58
|
+
# generator.attach_to_session()
|
|
59
|
+
|
|
60
|
+
except Exception as e:
|
|
61
|
+
print(f"❌ Error: {e}")
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
example_usage()
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Zellij layout generation utilities for creating KDL layout files.
|
|
4
|
+
"""
|
|
5
|
+
import shlex
|
|
6
|
+
import random
|
|
7
|
+
import string
|
|
8
|
+
from typing import Dict, List, Tuple
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
import logging
|
|
11
|
+
|
|
12
|
+
from rich.console import Console
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
console = Console()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class LayoutGenerator:
|
|
19
|
+
"""Handles generation of Zellij KDL layout files."""
|
|
20
|
+
|
|
21
|
+
LAYOUT_TEMPLATE = """layout {
|
|
22
|
+
default_tab_template {
|
|
23
|
+
// the default zellij tab-bar and status bar plugins
|
|
24
|
+
pane size=1 borderless=true {
|
|
25
|
+
plugin location="zellij:compact-bar"
|
|
26
|
+
}
|
|
27
|
+
children
|
|
28
|
+
}
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def generate_random_suffix(length: int = 8) -> str:
|
|
33
|
+
"""Generate a random string suffix for unique layout file names."""
|
|
34
|
+
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=length))
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def parse_command(command: str) -> Tuple[str, List[str]]:
|
|
38
|
+
"""Parse a command string into command and arguments."""
|
|
39
|
+
try:
|
|
40
|
+
parts = shlex.split(command)
|
|
41
|
+
if not parts:
|
|
42
|
+
raise ValueError("Empty command provided")
|
|
43
|
+
return parts[0], parts[1:] if len(parts) > 1 else []
|
|
44
|
+
except ValueError as e:
|
|
45
|
+
logger.error(f"Error parsing command '{command}': {e}")
|
|
46
|
+
parts = command.split()
|
|
47
|
+
return parts[0] if parts else "", parts[1:] if len(parts) > 1 else []
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def format_args_for_kdl(args: List[str]) -> str:
|
|
51
|
+
"""Format command arguments for KDL syntax."""
|
|
52
|
+
if not args:
|
|
53
|
+
return ""
|
|
54
|
+
formatted_args = []
|
|
55
|
+
for arg in args:
|
|
56
|
+
if ' ' in arg or '"' in arg or "'" in arg:
|
|
57
|
+
escaped_arg = arg.replace('"', '\\"')
|
|
58
|
+
formatted_args.append(f'"{escaped_arg}"')
|
|
59
|
+
else:
|
|
60
|
+
formatted_args.append(f'"{arg}"')
|
|
61
|
+
return " ".join(formatted_args)
|
|
62
|
+
|
|
63
|
+
@staticmethod
|
|
64
|
+
def create_tab_section(tab_name: str, cwd: str, command: str) -> str:
|
|
65
|
+
"""Create a KDL tab section for the layout."""
|
|
66
|
+
cmd, args = LayoutGenerator.parse_command(command)
|
|
67
|
+
args_str = LayoutGenerator.format_args_for_kdl(args)
|
|
68
|
+
tab_cwd = cwd or "~"
|
|
69
|
+
escaped_tab_name = tab_name.replace('"', '\\"')
|
|
70
|
+
|
|
71
|
+
tab_section = f' tab name="{escaped_tab_name}" cwd="{tab_cwd}" {{\n'
|
|
72
|
+
tab_section += f' pane command="{cmd}" {{\n'
|
|
73
|
+
if args_str:
|
|
74
|
+
tab_section += f' args {args_str}\n'
|
|
75
|
+
tab_section += ' }\n }\n'
|
|
76
|
+
return tab_section
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def validate_tab_config(tab_config: Dict[str, Tuple[str, str]]) -> None:
|
|
80
|
+
"""Validate tab configuration format and content."""
|
|
81
|
+
if not tab_config:
|
|
82
|
+
raise ValueError("Tab configuration cannot be empty")
|
|
83
|
+
for tab_name, (cwd, command) in tab_config.items():
|
|
84
|
+
if not tab_name.strip():
|
|
85
|
+
raise ValueError(f"Invalid tab name: {tab_name}")
|
|
86
|
+
if not command.strip():
|
|
87
|
+
raise ValueError(f"Invalid command for tab '{tab_name}': {command}")
|
|
88
|
+
if not cwd.strip():
|
|
89
|
+
raise ValueError(f"Invalid cwd for tab '{tab_name}': {cwd}")
|
|
90
|
+
|
|
91
|
+
def generate_layout_content(self, tab_config: Dict[str, Tuple[str, str]]) -> str:
|
|
92
|
+
"""Generate complete KDL layout content."""
|
|
93
|
+
self.validate_tab_config(tab_config)
|
|
94
|
+
|
|
95
|
+
layout_content = self.LAYOUT_TEMPLATE
|
|
96
|
+
for tab_name, (cwd, command) in tab_config.items():
|
|
97
|
+
layout_content += "\n" + self.create_tab_section(tab_name, cwd, command)
|
|
98
|
+
layout_content += "\n}\n"
|
|
99
|
+
|
|
100
|
+
return layout_content
|
|
101
|
+
|
|
102
|
+
def create_layout_file(self, tab_config: Dict[str, Tuple[str, str]],
|
|
103
|
+
output_dir: Path, session_name: str) -> str:
|
|
104
|
+
"""Create a layout file and return its absolute path."""
|
|
105
|
+
self.validate_tab_config(tab_config)
|
|
106
|
+
|
|
107
|
+
# Generate unique suffix for this layout
|
|
108
|
+
random_suffix = self.generate_random_suffix()
|
|
109
|
+
layout_content = self.generate_layout_content(tab_config)
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
# Create output directory if it doesn't exist
|
|
113
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
114
|
+
layout_file = output_dir / f"zellij_layout_{session_name}_{random_suffix}.kdl"
|
|
115
|
+
|
|
116
|
+
# Write layout file
|
|
117
|
+
with open(layout_file, 'w', encoding='utf-8') as f:
|
|
118
|
+
f.write(layout_content)
|
|
119
|
+
|
|
120
|
+
# Enhanced Rich logging
|
|
121
|
+
console.print(f"[bold green]✅ Zellij layout file created:[/bold green] [cyan]{layout_file.absolute()}[/cyan]")
|
|
122
|
+
return str(layout_file.absolute())
|
|
123
|
+
|
|
124
|
+
except OSError as e:
|
|
125
|
+
logger.error(f"Failed to create layout file: {e}")
|
|
126
|
+
raise
|