hypershell 2.8.2__tar.gz → 2.8.4__tar.gz
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.
- {hypershell-2.8.2 → hypershell-2.8.4}/PKG-INFO +2 -2
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/client_help.rst +2 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_groups_alt.rst +9 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/pyproject.toml +1 -1
- {hypershell-2.8.2 → hypershell-2.8.4}/share/man/man1/hs.1 +12 -1
- {hypershell-2.8.2 → hypershell-2.8.4}/share/man/man1/hsx.1 +12 -1
- {hypershell-2.8.2 → hypershell-2.8.4}/share/man/man1/hyper-shell.1 +12 -1
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/client.py +1 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/cluster/local.py +1 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/cluster/remote.py +5 -2
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/cluster/ssh.py +2 -1
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/queue.py +6 -1
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/data/model.py +42 -13
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/server.py +113 -12
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/conftest.py +36 -2
- hypershell-2.8.4/tests/test_group_order.py +470 -0
- hypershell-2.8.4/tests/test_queue_address_family.py +461 -0
- hypershell-2.8.4/tests/test_retry_gate.py +301 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/uv.lock +93 -64
- {hypershell-2.8.2 → hypershell-2.8.4}/.gitignore +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/CODE_OF_CONDUCT.md +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/LICENSE +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/README.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/Makefile +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/citation.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/client_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/client_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/cluster_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/cluster_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/cluster_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_edit_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_edit_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_edit_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_get_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_get_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_get_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_intro.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_intro_alt.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_param_ref.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_pythonpath.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_set_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_set_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_set_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_site_vars.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_task_env.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_task_env_alt.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_which_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_which_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/config_which_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/database.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/database_alt.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/exit_status.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/initdb_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/initdb_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/initdb_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/license.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/security_alt.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/server_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/server_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/server_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/signals.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/submit_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/submit_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/submit_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_info_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_info_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_info_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_run_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_run_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_run_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_search_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_search_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_search_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_submit_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_submit_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_submit_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_update_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_update_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_update_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_wait_desc.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_wait_help.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/task_wait_usage.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/templates.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/templates_alt.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_include/tls_cli_options.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_static/custom.css +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_static/logo-dark-mode.png +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/_static/logo-light-mode.png +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/api/client.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/api/cluster.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/api/data.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/api/index.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/api/server.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/api/submit.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20230329_2_2_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20230413_2_3_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20230602_2_4_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20240518_2_5_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20240706_2_5_2_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20241115_2_6_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20241115_announce_logo.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20241231_2_6_1_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20250215_2_6_5_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20250405_2_6_6_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20250504_2_7_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/20260705_2_8_0_release.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/blog/index.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/client.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/cluster.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/config.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/config_edit.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/config_get.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/config_set.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/config_which.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/index.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/initdb.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/server.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/submit.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/task_info.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/task_run.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/task_search.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/task_submit.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/task_update.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/cli/task_wait.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/conf.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/config.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/database.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/getting_started.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/index.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/install.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/logging.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/manual.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/roadmap.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/security.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/templates.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/tutorial/advanced.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/tutorial/basic.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/tutorial/distributed.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/docs/tutorial/hybrid.rst +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/share/bash_completion.d/hs +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/share/bash_completion.d/hsx +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/share/zsh/site-functions/_hs +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/__init__.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/cluster/__init__.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/config.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/__init__.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/config.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/exceptions.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/fsm.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/heartbeat.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/logging.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/platform.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/pretty_print.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/remote.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/resource.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/signal.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/sys.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/tag.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/template.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/thread.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/tls.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/types.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/core/uuid.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/data/__init__.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/data/core.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/submit.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/src/hypershell/task.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/__init__.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_autoscale.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_cancel.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_cluster.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_data/__init__.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_data/test_core.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_data/test_model.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_groups.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_initdb.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_logging.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_main.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_queue_tls.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_server.py +0 -0
- {hypershell-2.8.2 → hypershell-2.8.4}/tests/test_submit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: hypershell
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.4
|
|
4
4
|
Summary: A cross-platform, high-throughput computing utility for processing shell commands over a distributed, asynchronous queue.
|
|
5
5
|
Project-URL: Homepage, https://hypershell.org
|
|
6
6
|
Project-URL: Documentation, https://hypershell.readthedocs.io
|
|
@@ -88,6 +88,8 @@ Options
|
|
|
88
88
|
Timeout in seconds for client. Automatically shutdown if no tasks received (default: never).
|
|
89
89
|
|
|
90
90
|
This feature allows for gracefully scaling down a cluster when task throughput subsides.
|
|
91
|
+
The timeout counts from when the client starts, after any ``--delay-start``, so the delay
|
|
92
|
+
does not count toward it.
|
|
91
93
|
|
|
92
94
|
|
|
93
95
|
``-W``, ``--task-timeout`` *SEC*
|
|
@@ -16,5 +16,14 @@ exhausted), scheduling halts with a critical message; under ``--forever`` the sc
|
|
|
16
16
|
warns and waits for those tasks to be cleared or reverted (see ``hs update``). Use
|
|
17
17
|
``--max-retries`` and ``--eager`` to tune retry behavior within a group.
|
|
18
18
|
|
|
19
|
+
A task file given to ``hs cluster`` or ``hs server`` is read in full before scheduling begins, so
|
|
20
|
+
its groups run in ascending order whatever order the file lists them in. Input on standard input
|
|
21
|
+
or a pipe is scheduled as it arrives, which is best effort: a lower group that arrives after a
|
|
22
|
+
higher group has started runs once the current group finishes, and *HyperShell* logs a warning
|
|
23
|
+
naming both groups. The clients that ``hs cluster`` launches start once the file is read, so
|
|
24
|
+
their ``-T``/``--timeout`` clock does not run while it is read. A client connected to
|
|
25
|
+
``hs server`` whose ``-T``/``--timeout`` is shorter than the time to read the file reaches that
|
|
26
|
+
timeout and exits before any task is scheduled, and the server then waits for new clients.
|
|
27
|
+
|
|
19
28
|
Filter or update tasks by group with the ``-g``/``--group`` option of ``hs list`` and
|
|
20
29
|
``hs update``.
|
|
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
28
28
|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
29
29
|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
|
30
30
|
..
|
|
31
|
-
.TH "HS" "1" "
|
|
31
|
+
.TH "HS" "1" "Nov 04, 2026" "2.8.4" "hypershell"
|
|
32
32
|
.SH NAME
|
|
33
33
|
hs \- Process shell commands over a distributed, asynchronous queue
|
|
34
34
|
.SH SYNOPSIS
|
|
@@ -821,6 +821,8 @@ Mutually exclusive with both \fB\-\-output\fP and \fB\-\-errors\fP\&.
|
|
|
821
821
|
Timeout in seconds for client. Automatically shutdown if no tasks received (default: never).
|
|
822
822
|
.sp
|
|
823
823
|
This feature allows for gracefully scaling down a cluster when task throughput subsides.
|
|
824
|
+
The timeout counts from when the client starts, after any \fB\-\-delay\-start\fP, so the delay
|
|
825
|
+
does not count toward it.
|
|
824
826
|
.TP
|
|
825
827
|
.B \fB\-W\fP, \fB\-\-task\-timeout\fP \fISEC\fP
|
|
826
828
|
Task\-level walltime limit (default: none).
|
|
@@ -1775,6 +1777,15 @@ exhausted), scheduling halts with a critical message; under \fB\-\-forever\fP th
|
|
|
1775
1777
|
warns and waits for those tasks to be cleared or reverted (see \fBhs update\fP). Use
|
|
1776
1778
|
\fB\-\-max\-retries\fP and \fB\-\-eager\fP to tune retry behavior within a group.
|
|
1777
1779
|
.sp
|
|
1780
|
+
A task file given to \fBhs cluster\fP or \fBhs server\fP is read in full before scheduling begins, so
|
|
1781
|
+
its groups run in ascending order whatever order the file lists them in. Input on standard input
|
|
1782
|
+
or a pipe is scheduled as it arrives, which is best effort: a lower group that arrives after a
|
|
1783
|
+
higher group has started runs once the current group finishes, and \fIHyperShell\fP logs a warning
|
|
1784
|
+
naming both groups. The clients that \fBhs cluster\fP launches start once the file is read, so
|
|
1785
|
+
their \fB\-T\fP/\fB\-\-timeout\fP clock does not run while it is read. A client connected to
|
|
1786
|
+
\fBhs server\fP whose \fB\-T\fP/\fB\-\-timeout\fP is shorter than the time to read the file reaches that
|
|
1787
|
+
timeout and exits before any task is scheduled, and the server then waits for new clients.
|
|
1788
|
+
.sp
|
|
1778
1789
|
Filter or update tasks by group with the \fB\-g\fP/\fB\-\-group\fP option of \fBhs list\fP and
|
|
1779
1790
|
\fBhs update\fP\&.
|
|
1780
1791
|
.SH CONFIGURATION
|
|
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
28
28
|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
29
29
|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
|
30
30
|
..
|
|
31
|
-
.TH "HS" "1" "
|
|
31
|
+
.TH "HS" "1" "Nov 04, 2026" "2.8.4" "hypershell"
|
|
32
32
|
.SH NAME
|
|
33
33
|
hs \- Process shell commands over a distributed, asynchronous queue
|
|
34
34
|
.SH SYNOPSIS
|
|
@@ -821,6 +821,8 @@ Mutually exclusive with both \fB\-\-output\fP and \fB\-\-errors\fP\&.
|
|
|
821
821
|
Timeout in seconds for client. Automatically shutdown if no tasks received (default: never).
|
|
822
822
|
.sp
|
|
823
823
|
This feature allows for gracefully scaling down a cluster when task throughput subsides.
|
|
824
|
+
The timeout counts from when the client starts, after any \fB\-\-delay\-start\fP, so the delay
|
|
825
|
+
does not count toward it.
|
|
824
826
|
.TP
|
|
825
827
|
.B \fB\-W\fP, \fB\-\-task\-timeout\fP \fISEC\fP
|
|
826
828
|
Task\-level walltime limit (default: none).
|
|
@@ -1775,6 +1777,15 @@ exhausted), scheduling halts with a critical message; under \fB\-\-forever\fP th
|
|
|
1775
1777
|
warns and waits for those tasks to be cleared or reverted (see \fBhs update\fP). Use
|
|
1776
1778
|
\fB\-\-max\-retries\fP and \fB\-\-eager\fP to tune retry behavior within a group.
|
|
1777
1779
|
.sp
|
|
1780
|
+
A task file given to \fBhs cluster\fP or \fBhs server\fP is read in full before scheduling begins, so
|
|
1781
|
+
its groups run in ascending order whatever order the file lists them in. Input on standard input
|
|
1782
|
+
or a pipe is scheduled as it arrives, which is best effort: a lower group that arrives after a
|
|
1783
|
+
higher group has started runs once the current group finishes, and \fIHyperShell\fP logs a warning
|
|
1784
|
+
naming both groups. The clients that \fBhs cluster\fP launches start once the file is read, so
|
|
1785
|
+
their \fB\-T\fP/\fB\-\-timeout\fP clock does not run while it is read. A client connected to
|
|
1786
|
+
\fBhs server\fP whose \fB\-T\fP/\fB\-\-timeout\fP is shorter than the time to read the file reaches that
|
|
1787
|
+
timeout and exits before any task is scheduled, and the server then waits for new clients.
|
|
1788
|
+
.sp
|
|
1778
1789
|
Filter or update tasks by group with the \fB\-g\fP/\fB\-\-group\fP option of \fBhs list\fP and
|
|
1779
1790
|
\fBhs update\fP\&.
|
|
1780
1791
|
.SH CONFIGURATION
|
|
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
28
28
|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
29
29
|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
|
30
30
|
..
|
|
31
|
-
.TH "HYPER-SHELL" "1" "
|
|
31
|
+
.TH "HYPER-SHELL" "1" "Nov 04, 2026" "2.8.4" "hypershell"
|
|
32
32
|
.SH NAME
|
|
33
33
|
hyper-shell \- Process shell commands over a distributed, asynchronous queue
|
|
34
34
|
.SH SYNOPSIS
|
|
@@ -821,6 +821,8 @@ Mutually exclusive with both \fB\-\-output\fP and \fB\-\-errors\fP\&.
|
|
|
821
821
|
Timeout in seconds for client. Automatically shutdown if no tasks received (default: never).
|
|
822
822
|
.sp
|
|
823
823
|
This feature allows for gracefully scaling down a cluster when task throughput subsides.
|
|
824
|
+
The timeout counts from when the client starts, after any \fB\-\-delay\-start\fP, so the delay
|
|
825
|
+
does not count toward it.
|
|
824
826
|
.TP
|
|
825
827
|
.B \fB\-W\fP, \fB\-\-task\-timeout\fP \fISEC\fP
|
|
826
828
|
Task\-level walltime limit (default: none).
|
|
@@ -1775,6 +1777,15 @@ exhausted), scheduling halts with a critical message; under \fB\-\-forever\fP th
|
|
|
1775
1777
|
warns and waits for those tasks to be cleared or reverted (see \fBhs update\fP). Use
|
|
1776
1778
|
\fB\-\-max\-retries\fP and \fB\-\-eager\fP to tune retry behavior within a group.
|
|
1777
1779
|
.sp
|
|
1780
|
+
A task file given to \fBhs cluster\fP or \fBhs server\fP is read in full before scheduling begins, so
|
|
1781
|
+
its groups run in ascending order whatever order the file lists them in. Input on standard input
|
|
1782
|
+
or a pipe is scheduled as it arrives, which is best effort: a lower group that arrives after a
|
|
1783
|
+
higher group has started runs once the current group finishes, and \fIHyperShell\fP logs a warning
|
|
1784
|
+
naming both groups. The clients that \fBhs cluster\fP launches start once the file is read, so
|
|
1785
|
+
their \fB\-T\fP/\fB\-\-timeout\fP clock does not run while it is read. A client connected to
|
|
1786
|
+
\fBhs server\fP whose \fB\-T\fP/\fB\-\-timeout\fP is shorter than the time to read the file reaches that
|
|
1787
|
+
timeout and exits before any task is scheduled, and the server then waits for new clients.
|
|
1788
|
+
.sp
|
|
1778
1789
|
Filter or update tasks by group with the \fB\-g\fP/\fB\-\-group\fP option of \fBhs list\fP and
|
|
1779
1790
|
\fBhs update\fP\&.
|
|
1780
1791
|
.SH CONFIGURATION
|
|
@@ -201,6 +201,7 @@ class ClientScheduler(StateMachine):
|
|
|
201
201
|
"""Jump to GET_REMOTE state."""
|
|
202
202
|
timeout_label = self.timeout or 'no'
|
|
203
203
|
log.debug(f'Started (scheduler: {timeout_label} timeout)')
|
|
204
|
+
self.previous_received = datetime.now() # NOTE: idle time counts from start, not construction
|
|
204
205
|
return SchedulerState.GET_REMOTE
|
|
205
206
|
|
|
206
207
|
def get_remote(self: ClientScheduler) -> SchedulerState:
|
|
@@ -250,6 +250,7 @@ class LocalCluster(Thread):
|
|
|
250
250
|
"""Start child threads, wait."""
|
|
251
251
|
set_client_standalone(False)
|
|
252
252
|
self.server.start()
|
|
253
|
+
self.server.wait_scheduling() # NOTE: clients never idle while a task file is read
|
|
253
254
|
self.client.start()
|
|
254
255
|
self.client.join()
|
|
255
256
|
self.server.join()
|
|
@@ -215,7 +215,7 @@ class RemoteCluster(Thread):
|
|
|
215
215
|
"""
|
|
216
216
|
|
|
217
217
|
server: ServerThread
|
|
218
|
-
clients: Popen
|
|
218
|
+
clients: Optional[Popen] = None
|
|
219
219
|
client_argv: List[str]
|
|
220
220
|
|
|
221
221
|
def __init__(self: RemoteCluster,
|
|
@@ -304,6 +304,7 @@ class RemoteCluster(Thread):
|
|
|
304
304
|
def run_with_exceptions(self: RemoteCluster) -> None:
|
|
305
305
|
"""Start child threads, wait."""
|
|
306
306
|
self.server.start()
|
|
307
|
+
self.server.wait_scheduling() # NOTE: clients never idle while a task file is read
|
|
307
308
|
log.debug('Launching clients: ' + redact_secrets(self.client_argv, ['-k']))
|
|
308
309
|
self.clients = Popen(self.client_argv,
|
|
309
310
|
stdout=sys.stdout, stderr=sys.stderr,
|
|
@@ -314,7 +315,8 @@ class RemoteCluster(Thread):
|
|
|
314
315
|
def stop(self: RemoteCluster, wait: bool = False, timeout: int = None) -> None:
|
|
315
316
|
"""Stop child threads before main thread."""
|
|
316
317
|
self.server.stop(wait=wait, timeout=timeout)
|
|
317
|
-
self.clients
|
|
318
|
+
if self.clients is not None:
|
|
319
|
+
self.clients.terminate()
|
|
318
320
|
super().stop(wait=wait, timeout=timeout)
|
|
319
321
|
|
|
320
322
|
|
|
@@ -829,6 +831,7 @@ class AutoScalingCluster(Thread):
|
|
|
829
831
|
def run_with_exceptions(self: AutoScalingCluster) -> None:
|
|
830
832
|
"""Start child threads, wait."""
|
|
831
833
|
self.server.start()
|
|
834
|
+
self.server.wait_scheduling() # NOTE: clients never idle while a task file is read
|
|
832
835
|
self.autoscaler.start()
|
|
833
836
|
self.autoscaler.join()
|
|
834
837
|
self.server.join()
|
|
@@ -298,8 +298,9 @@ class SSHCluster(Thread):
|
|
|
298
298
|
|
|
299
299
|
def run_with_exceptions(self: SSHCluster) -> None:
|
|
300
300
|
"""Start child threads, wait."""
|
|
301
|
+
self.clients = [] # NOTE: empty for stop() until the clients are launched
|
|
301
302
|
self.server.start()
|
|
302
|
-
self.clients
|
|
303
|
+
self.server.wait_scheduling() # NOTE: clients never idle while a task file is read
|
|
303
304
|
for argv in self.client_argv:
|
|
304
305
|
log.debug('Launching client: ' + redact_secrets(argv, ['-k']))
|
|
305
306
|
self.clients.append(Popen(argv, stdout=sys.stdout, stderr=sys.stderr))
|
|
@@ -213,8 +213,13 @@ def secure_client(address, family=None, authkey: Optional[bytes] = None) -> Secu
|
|
|
213
213
|
"""
|
|
214
214
|
cfg = get_tls_config()
|
|
215
215
|
ctx = get_client_context()
|
|
216
|
-
|
|
216
|
+
# Dial IPv4 only, exactly as the cleartext client does: the listener binds AF_INET, so
|
|
217
|
+
# following the resolver to an IPv6 address (e.g., `localhost` -> ::1) could reach some
|
|
218
|
+
# other process holding the same port number there instead of the server.
|
|
219
|
+
raw = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
217
220
|
try:
|
|
221
|
+
raw.setblocking(True)
|
|
222
|
+
raw.connect(address)
|
|
218
223
|
servername = (cfg.servername if cfg is not None and cfg.servername else None)
|
|
219
224
|
if servername is None and ctx.check_hostname:
|
|
220
225
|
servername = address[0] if isinstance(address, tuple) else None
|
|
@@ -431,12 +431,18 @@ class Task(Entity):
|
|
|
431
431
|
return TaskGroupInfo(submitted_task.group, f'no tasks scheduled - defaulting to earliest group')
|
|
432
432
|
|
|
433
433
|
@classmethod
|
|
434
|
-
def increment_group(cls: Type[Task], previous_group: int, attempts: int) -> TaskGroupInfo:
|
|
434
|
+
def increment_group(cls: Type[Task], previous_group: int, attempts: int, eager: bool = False) -> TaskGroupInfo:
|
|
435
435
|
"""
|
|
436
436
|
This should only be called if no tasks are returned by Task.next().
|
|
437
437
|
Check the current group and increment if necessary with explanation.
|
|
438
438
|
We assume all tasks in `previous_group` have already been scheduled (see Task.next()).
|
|
439
|
+
A group is held while it has incomplete tasks or failures still awaiting retry.
|
|
440
|
+
The next group is the lowest group holding incomplete tasks, which may be lower than
|
|
441
|
+
`previous_group` when tasks are submitted late.
|
|
439
442
|
"""
|
|
443
|
+
# Incomplete tasks are counted before retryable failures, so a result written back between
|
|
444
|
+
# the two checks is always seen by the second. Retryable failures are counted before
|
|
445
|
+
# exhausted ones, so a group holding both is held rather than halted.
|
|
440
446
|
remaining = (
|
|
441
447
|
Session.query(Task)
|
|
442
448
|
.filter(Task.group == previous_group)
|
|
@@ -445,6 +451,9 @@ class Task(Entity):
|
|
|
445
451
|
)
|
|
446
452
|
if remaining > 0:
|
|
447
453
|
return TaskGroupInfo(previous_group, f'waiting on {remaining} tasks to complete')
|
|
454
|
+
retryable = cls.count_retryable(attempts, previous_group, eager=eager)
|
|
455
|
+
if retryable > 0:
|
|
456
|
+
return TaskGroupInfo(previous_group, f'waiting on {retryable} failed tasks to be retried')
|
|
448
457
|
failed_query = (
|
|
449
458
|
Session.query(Task)
|
|
450
459
|
.filter(Task.group == previous_group)
|
|
@@ -460,16 +469,20 @@ class Task(Entity):
|
|
|
460
469
|
return TaskGroupInfo(previous_group,
|
|
461
470
|
f'at least {failed} tasks exceeding allowed retries, example: {example.id}',
|
|
462
471
|
False)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
.first()
|
|
468
|
-
)
|
|
469
|
-
if not next_group:
|
|
472
|
+
# The next group is chosen in one query, so rows committed while the checks above ran are
|
|
473
|
+
# never skipped; it is lower than the previous group when tasks were submitted late.
|
|
474
|
+
next_group = cls.lowest_incomplete_group()
|
|
475
|
+
if next_group is None:
|
|
470
476
|
return TaskGroupInfo(previous_group, f'no task groups remain')
|
|
477
|
+
elif next_group == previous_group:
|
|
478
|
+
return TaskGroupInfo(previous_group, f'new tasks submitted')
|
|
471
479
|
else:
|
|
472
|
-
return TaskGroupInfo(next_group
|
|
480
|
+
return TaskGroupInfo(next_group)
|
|
481
|
+
|
|
482
|
+
@classmethod
|
|
483
|
+
def lowest_incomplete_group(cls: Type[Task]) -> Optional[int]:
|
|
484
|
+
"""The smallest group holding a task that has not completed, or None."""
|
|
485
|
+
return Session.query(func.min(cls.group)).filter(cls.completion_time.is_(None)).scalar()
|
|
473
486
|
|
|
474
487
|
@classmethod
|
|
475
488
|
def select_new(cls: Type[Task], limit: int, group: int = None) -> List[Task]:
|
|
@@ -480,10 +493,9 @@ class Task(Entity):
|
|
|
480
493
|
return query.limit(limit).all()
|
|
481
494
|
|
|
482
495
|
@classmethod
|
|
483
|
-
def
|
|
484
|
-
"""
|
|
496
|
+
def query_retryable(cls: Type[Task], attempts: int, group: int = None) -> Query:
|
|
497
|
+
"""Query failed tasks still eligible for retry under given number of `attempts`."""
|
|
485
498
|
query = (cls.query()
|
|
486
|
-
.order_by(cls.completion_time)
|
|
487
499
|
.filter(cls.exit_status.isnot(None))
|
|
488
500
|
.filter(cls.exit_status != 0)
|
|
489
501
|
.filter(cls.exit_status != CANCEL_STATUS) # NOTE: cancelled is terminal, not a failure
|
|
@@ -491,7 +503,24 @@ class Task(Entity):
|
|
|
491
503
|
.filter(cls.retried.is_(False)))
|
|
492
504
|
if group is not None:
|
|
493
505
|
query = query.filter(cls.group == group)
|
|
494
|
-
return query
|
|
506
|
+
return query
|
|
507
|
+
|
|
508
|
+
@classmethod
|
|
509
|
+
def select_failed(cls: Type[Task], attempts: int, limit: int, group: int = None) -> List[Task]:
|
|
510
|
+
"""Select failed tasks for retry up to some `limit` under given number of `attempts`."""
|
|
511
|
+
return cls.query_retryable(attempts, group=group).order_by(cls.completion_time).limit(limit).all()
|
|
512
|
+
|
|
513
|
+
@classmethod
|
|
514
|
+
def count_retryable(cls: Type[Task], attempts: int, group: int, eager: bool = False) -> int:
|
|
515
|
+
"""
|
|
516
|
+
Count failed tasks in `group` awaiting retry under given number of `attempts`.
|
|
517
|
+
The failures counted are exactly the failures Task.next() retries for the same
|
|
518
|
+
`group`, `attempts`, and `eager`. Without `eager`, failures are only retried when
|
|
519
|
+
`attempts` exceeds one.
|
|
520
|
+
"""
|
|
521
|
+
if attempts <= 1 and not eager:
|
|
522
|
+
return 0
|
|
523
|
+
return cls.query_retryable(attempts, group=group).count()
|
|
495
524
|
|
|
496
525
|
@classmethod
|
|
497
526
|
def next(cls: Type[Task],
|
|
@@ -46,9 +46,11 @@ from typing import List, Dict, Tuple, Iterable, IO, Optional, Callable, Type, Fi
|
|
|
46
46
|
from types import TracebackType
|
|
47
47
|
|
|
48
48
|
# Standard libs
|
|
49
|
+
import io
|
|
49
50
|
import sys
|
|
50
51
|
import time
|
|
51
52
|
from enum import Enum
|
|
53
|
+
from numbers import Real
|
|
52
54
|
from datetime import datetime, timedelta
|
|
53
55
|
from functools import cached_property
|
|
54
56
|
from itertools import islice
|
|
@@ -75,7 +77,7 @@ from hypershell.submit import SubmitThread, LiveSubmitThread, DEFAULT_BUNDLEWAIT
|
|
|
75
77
|
from hypershell.client import ClientInfo
|
|
76
78
|
|
|
77
79
|
# Public interface
|
|
78
|
-
__all__ = ['serve_from', 'serve_file', 'serve_forever', 'ServerThread', 'ServerApp',
|
|
80
|
+
__all__ = ['serve_from', 'serve_file', 'serve_forever', 'ServerThread', 'ServerApp', 'is_file_input',
|
|
79
81
|
'DEFAULT_BUNDLESIZE', 'DEFAULT_BUNDLEWAIT', 'DEFAULT_ATTEMPTS',
|
|
80
82
|
'DEFAULT_EVICT', 'DEFAULT_EAGER_MODE', 'DEFAULT_SERVER_POLL',
|
|
81
83
|
'DEFAULT_BIND', 'DEFAULT_PORT', 'DEFAULT_AUTH']
|
|
@@ -127,6 +129,9 @@ class Scheduler(StateMachine):
|
|
|
127
129
|
poll: float
|
|
128
130
|
poll_max: float
|
|
129
131
|
startup_phase: bool
|
|
132
|
+
first_group_pending: bool
|
|
133
|
+
highest_started_group: Optional[int]
|
|
134
|
+
last_scheduled_group: Optional[int]
|
|
130
135
|
current_group: Optional[int]
|
|
131
136
|
|
|
132
137
|
state = SchedulerState.START
|
|
@@ -149,6 +154,9 @@ class Scheduler(StateMachine):
|
|
|
149
154
|
self.poll = SERVER_POLL_MIN
|
|
150
155
|
self.poll_max = poll
|
|
151
156
|
self.startup_phase = not self.restart_mode # NOTE: Halt if everything in the database is already finished
|
|
157
|
+
self.first_group_pending = False
|
|
158
|
+
self.highest_started_group = None
|
|
159
|
+
self.last_scheduled_group = None
|
|
152
160
|
self.current_group = None
|
|
153
161
|
|
|
154
162
|
@cached_property
|
|
@@ -180,9 +188,10 @@ class Scheduler(StateMachine):
|
|
|
180
188
|
log.info(f'Reverted {tasks_interrupted} previously interrupted tasks')
|
|
181
189
|
else:
|
|
182
190
|
log.info('Empty database - waiting for initial tasks')
|
|
191
|
+
self.first_group_pending = True
|
|
183
192
|
group_info = Task.current_group()
|
|
184
193
|
log.debug(f'Starting with task group {group_info.value} ({group_info.reason})')
|
|
185
|
-
self.current_group = group_info.value
|
|
194
|
+
self.current_group = self.starting_group(group_info.value)
|
|
186
195
|
return SchedulerState.LOAD
|
|
187
196
|
|
|
188
197
|
def load_bundle(self: Scheduler) -> SchedulerState:
|
|
@@ -190,18 +199,20 @@ class Scheduler(StateMachine):
|
|
|
190
199
|
if check_signal() in (SIGUSR1, SIGUSR2):
|
|
191
200
|
log.warning(f'Signal interrupt ({SIGNAL_MAP[check_signal()]})')
|
|
192
201
|
return SchedulerState.FINAL
|
|
193
|
-
self.tasks =
|
|
194
|
-
attempts=self.attempts,
|
|
195
|
-
eager=self.eager,
|
|
196
|
-
group=self.current_group)
|
|
202
|
+
self.tasks = self.next_tasks()
|
|
197
203
|
if self.tasks:
|
|
204
|
+
self.mark_group_started()
|
|
198
205
|
self.startup_phase = False
|
|
199
206
|
self.poll = SERVER_POLL_MIN
|
|
200
207
|
return SchedulerState.PACK
|
|
201
|
-
elif not self.forever_mode and Task.count() > 0 and Task.count_remaining() == 0
|
|
208
|
+
elif (not self.forever_mode and Task.count() > 0 and Task.count_remaining() == 0
|
|
209
|
+
and Task.count_retryable(self.attempts, group=self.current_group, eager=self.eager) == 0
|
|
210
|
+
and not self.startup_phase):
|
|
211
|
+
# A failure written back after Task.next() is still retried before the run stops;
|
|
212
|
+
# retryable failures are counted after incomplete tasks so that write is always seen.
|
|
202
213
|
return SchedulerState.FINAL
|
|
203
214
|
else:
|
|
204
|
-
group_info = Task.increment_group(self.current_group, attempts=self.attempts)
|
|
215
|
+
group_info = Task.increment_group(self.current_group, attempts=self.attempts, eager=self.eager)
|
|
205
216
|
if not group_info.viable:
|
|
206
217
|
if self.forever_mode:
|
|
207
218
|
log.warning(f'Failed task group {group_info.value} ({group_info.reason})')
|
|
@@ -219,6 +230,60 @@ class Scheduler(StateMachine):
|
|
|
219
230
|
time.sleep(self.poll)
|
|
220
231
|
return SchedulerState.LOAD
|
|
221
232
|
|
|
233
|
+
def next_tasks(self: Scheduler) -> List[Task]:
|
|
234
|
+
"""Select the next tasks to schedule from the current group."""
|
|
235
|
+
if self.first_group_pending:
|
|
236
|
+
# On an empty-database start no task is scheduled into a group chosen before any task
|
|
237
|
+
# existed: the first group is the lowest one holding tasks, once there are any.
|
|
238
|
+
first_group = Task.lowest_incomplete_group()
|
|
239
|
+
if first_group is None:
|
|
240
|
+
return []
|
|
241
|
+
self.current_group = first_group
|
|
242
|
+
return Task.next(limit=self.bundlesize,
|
|
243
|
+
attempts=self.attempts,
|
|
244
|
+
eager=self.eager,
|
|
245
|
+
group=self.current_group)
|
|
246
|
+
|
|
247
|
+
def mark_group_started(self: Scheduler) -> None:
|
|
248
|
+
"""Record that the current group has scheduled tasks, warning if a higher group started first."""
|
|
249
|
+
group = self.current_group
|
|
250
|
+
if group != self.last_scheduled_group:
|
|
251
|
+
# SQLite can store a non-integer group as text, which has no order against an integer
|
|
252
|
+
# group: it is never tracked as the highest group and never warned on.
|
|
253
|
+
if isinstance(group, Real):
|
|
254
|
+
highest = self.highest_started_group
|
|
255
|
+
if highest is not None and group < highest:
|
|
256
|
+
log.warning(f'Starting task group {group} after task group {highest} (tasks submitted late)')
|
|
257
|
+
self.highest_started_group = group if highest is None else max(group, highest)
|
|
258
|
+
self.last_scheduled_group = group
|
|
259
|
+
self.first_group_pending = False
|
|
260
|
+
|
|
261
|
+
def starting_group(self: Scheduler, group: int) -> int:
|
|
262
|
+
"""
|
|
263
|
+
The task group to start in, given the most recently scheduled `group`.
|
|
264
|
+
|
|
265
|
+
That group is kept while it holds failures still to be retried or halted on. Otherwise the
|
|
266
|
+
start is the lowest group holding incomplete tasks, so new tasks on a database whose earlier
|
|
267
|
+
work finished at a higher group run in ascending order. With no incomplete tasks yet, the
|
|
268
|
+
first group is chosen once tasks arrive, as on an empty database.
|
|
269
|
+
"""
|
|
270
|
+
if self.first_group_pending:
|
|
271
|
+
return group
|
|
272
|
+
if Task.count_remaining(group=group) == 0:
|
|
273
|
+
# With every task in the group complete, increment_group holds the group while a
|
|
274
|
+
# failure awaits retry, and halts it on a failure that has used its retries.
|
|
275
|
+
held = Task.increment_group(group, attempts=self.attempts, eager=self.eager)
|
|
276
|
+
if not held.viable or Task.count_retryable(self.attempts, group=group, eager=self.eager) > 0:
|
|
277
|
+
return group
|
|
278
|
+
lowest = Task.lowest_incomplete_group()
|
|
279
|
+
if lowest is None:
|
|
280
|
+
log.debug('No incomplete tasks - first task group chosen once tasks arrive')
|
|
281
|
+
self.first_group_pending = True
|
|
282
|
+
return group
|
|
283
|
+
if lowest != group:
|
|
284
|
+
log.debug(f'Moving to task group {lowest} (lowest group with incomplete tasks)')
|
|
285
|
+
return lowest
|
|
286
|
+
|
|
222
287
|
def pack_bundle(self: Scheduler) -> SchedulerState:
|
|
223
288
|
"""Pack tasks into bundle (list)."""
|
|
224
289
|
self.bundle = serialize_tasks(self.tasks)
|
|
@@ -831,15 +896,31 @@ class ServerThread(Thread):
|
|
|
831
896
|
time.sleep(0.1)
|
|
832
897
|
|
|
833
898
|
def start_threads(self: ServerThread) -> None:
|
|
834
|
-
"""Start child threads."""
|
|
899
|
+
"""Start child threads; with file input, scheduling starts once the whole file is submitted."""
|
|
835
900
|
if self.submitter is not None:
|
|
836
901
|
self.submitter.start()
|
|
837
|
-
if self.scheduler is not None:
|
|
838
|
-
self.scheduler.start()
|
|
839
902
|
if self.confirm is not None:
|
|
840
903
|
self.confirm.start()
|
|
841
904
|
self.heartmonitor.start()
|
|
842
905
|
self.receiver.start()
|
|
906
|
+
if self.scheduler is not None:
|
|
907
|
+
if self.submitter is not None and is_file_input(self.submitter.source):
|
|
908
|
+
# The scheduler sees every group in the file before it chooses the first one,
|
|
909
|
+
# so the file's groups run in ascending order whatever order they are listed.
|
|
910
|
+
log.info('Waiting for task file to be submitted before scheduling')
|
|
911
|
+
self.wait_submitter()
|
|
912
|
+
self.scheduler.start()
|
|
913
|
+
|
|
914
|
+
def wait_scheduling(self: ServerThread) -> None:
|
|
915
|
+
"""Wait until scheduling starts, which for file input is once the whole file is submitted.
|
|
916
|
+
|
|
917
|
+
Clients started after this never idle while a task file is read. If the server stops
|
|
918
|
+
first, its error (if any) is raised here.
|
|
919
|
+
"""
|
|
920
|
+
while self.scheduler is not None and self.scheduler.ident is None and self.is_alive():
|
|
921
|
+
time.sleep(0.1)
|
|
922
|
+
if not self.is_alive():
|
|
923
|
+
self.join()
|
|
843
924
|
|
|
844
925
|
def wait_submitter(self: ServerThread) -> None:
|
|
845
926
|
"""Wait on task submission to complete."""
|
|
@@ -879,7 +960,9 @@ class ServerThread(Thread):
|
|
|
879
960
|
if self.submitter is not None:
|
|
880
961
|
self.submitter.stop(wait=wait, timeout=timeout)
|
|
881
962
|
if self.scheduler is not None:
|
|
882
|
-
|
|
963
|
+
# A scheduler not yet started, because a task file is still being submitted, has
|
|
964
|
+
# nothing to join.
|
|
965
|
+
self.scheduler.stop(wait=wait and self.scheduler.ident is not None, timeout=timeout)
|
|
883
966
|
self.heartmonitor.stop(wait=wait, timeout=timeout)
|
|
884
967
|
self.queue.completed.put(make_sentinel())
|
|
885
968
|
self.receiver.stop(wait=wait, timeout=timeout)
|
|
@@ -889,6 +972,24 @@ class ServerThread(Thread):
|
|
|
889
972
|
super().stop(wait=wait, timeout=timeout)
|
|
890
973
|
|
|
891
974
|
|
|
975
|
+
def is_file_input(source: Iterable[str | dict]) -> bool:
|
|
976
|
+
"""True if `source` is a whole task file: a seekable file (not standard input), or a list or tuple.
|
|
977
|
+
|
|
978
|
+
Standard input, pipes, FIFOs, process substitution and other iterables are streams, which
|
|
979
|
+
are scheduled as they arrive.
|
|
980
|
+
"""
|
|
981
|
+
# A gated source carries the stream it wraps as `iterable`.
|
|
982
|
+
inner = getattr(source, 'iterable', source)
|
|
983
|
+
if isinstance(inner, (list, tuple)):
|
|
984
|
+
return True
|
|
985
|
+
if isinstance(inner, io.IOBase) and inner is not sys.stdin:
|
|
986
|
+
try:
|
|
987
|
+
return inner.seekable()
|
|
988
|
+
except (OSError, ValueError):
|
|
989
|
+
return False
|
|
990
|
+
return False
|
|
991
|
+
|
|
992
|
+
|
|
892
993
|
def serve_from(source: Iterable[str],
|
|
893
994
|
restart_mode: bool = False,
|
|
894
995
|
task_cores: int = None,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Standard libs
|
|
8
8
|
import os
|
|
9
|
+
import errno
|
|
9
10
|
import socket
|
|
10
11
|
|
|
11
12
|
# External libs
|
|
@@ -13,13 +14,46 @@ from pytest import fixture
|
|
|
13
14
|
from pathlib import Path
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
# Upper bound on draws before free_port() gives up (loud rather than flaky).
|
|
18
|
+
FREE_PORT_DRAWS: int = 32
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def draw_port() -> int:
|
|
22
|
+
"""Return a TCP port number the kernel reports free on IPv4 loopback."""
|
|
18
23
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
|
19
24
|
sock.bind(('localhost', 0))
|
|
20
25
|
return sock.getsockname()[1]
|
|
21
26
|
|
|
22
27
|
|
|
28
|
+
def held_on_ipv6_loopback(port: int) -> bool:
|
|
29
|
+
"""True if `port` is already bound on ``::1``; False if free there or no IPv6 loopback."""
|
|
30
|
+
try:
|
|
31
|
+
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
|
32
|
+
except OSError:
|
|
33
|
+
return False
|
|
34
|
+
with sock:
|
|
35
|
+
try:
|
|
36
|
+
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
|
|
37
|
+
sock.bind(('::1', port))
|
|
38
|
+
except OSError as error:
|
|
39
|
+
return error.errno == errno.EADDRINUSE
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def free_port() -> int:
|
|
44
|
+
"""Return a TCP port number free on IPv4 loopback and, if the host has it, on ``::1``.
|
|
45
|
+
|
|
46
|
+
The server listens on IPv4 only, but a port number some other process holds on ``::1``
|
|
47
|
+
can still capture a client that resolves ``localhost`` to IPv6 first, so such a number
|
|
48
|
+
is drawn again. Raises RuntimeError after :data:`FREE_PORT_DRAWS` draws.
|
|
49
|
+
"""
|
|
50
|
+
for _ in range(FREE_PORT_DRAWS):
|
|
51
|
+
port = draw_port()
|
|
52
|
+
if not held_on_ipv6_loopback(port):
|
|
53
|
+
return port
|
|
54
|
+
raise RuntimeError(f'No port free on both loopbacks after {FREE_PORT_DRAWS} draws')
|
|
55
|
+
|
|
56
|
+
|
|
23
57
|
def isolate_environment() -> None:
|
|
24
58
|
"""Scrub all ``HYPERSHELL_*`` variables and pin a clean baseline.
|
|
25
59
|
|