Skip to content

Commit 4d9514e

Browse files
committed
Updates based on code review
1 parent 003ac9e commit 4d9514e

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

crates/hyperqueue/src/client/output/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use crate::server::autoalloc::{Allocation, AllocationState};
1313
use crate::server::job::{JobTaskCounters, JobTaskInfo, JobTaskState};
1414
use crate::stream::reader::outputlog::Summary;
1515
use crate::transfer::messages::{
16-
AutoAllocListQueuesResponse, JobDetail, JobInfo, JobTaskDescription, QueueData,
17-
QueueState, ServerInfo, TaskDescription, TaskKind, TaskKindProgram, WaitForJobsResponse,
18-
WorkerExitInfo, WorkerInfo,
16+
AutoAllocListQueuesResponse, JobDetail, JobInfo, JobTaskDescription, QueueData, QueueState,
17+
ServerInfo, TaskDescription, TaskKind, TaskKindProgram, WaitForJobsResponse, WorkerExitInfo,
18+
WorkerInfo,
1919
};
2020
use tako::{JobId, JobTaskCount, JobTaskId, TaskId, WorkerId};
2121

docs/jobs/resources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,12 @@ They are used to adjust priority between different tasks or between multiple res
367367
task.
368368
369369
The default resource weight is **1.0**. You can modify this using the --weight=<number>` option.
370-
Weights function as a multiplier for resource "value". For example, a task equesting 6 CPUs with a weight of 1.0
370+
Weights function as a multiplier for resource "value". For example, a task requesting 6 CPUs with a weight of 1.0
371371
carries the same weight in the scheduler as a task requesting 2 CPUs with a eight of 3.0.
372372
373373
### Weights vs. Priorities
374374
375-
While both systems influence scheduling order, they function on different logic. he table below outlines the primary
375+
While both systems influence scheduling order, they function on different logic. The table below outlines the primary
376376
distinctions:
377377
378378
| Feature | Priorities | Weights |

tests/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99

1010
import pytest
1111

12-
pytest.register_assert_rewrite("tests.utils.table")
13-
14-
from .utils import parse_tables
1512
from .utils.mock import ProgramMock
1613
from .utils.wait import wait_until
1714

15+
pytest.register_assert_rewrite("tests.utils.table")
16+
17+
from .utils import parse_tables # noqa: E402
18+
1819
PYTEST_DIR = os.path.dirname(os.path.abspath(__file__))
1920
ROOT_DIR = os.path.dirname(PYTEST_DIR)
2021

tests/test_jobfile.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,26 @@ def test_job_file_multinode(hq_env: HqEnv, tmp_path):
462462
with open(default_task_output(1)) as f:
463463
lines = sorted(f.read().rstrip().split("\n"))
464464
assert lines == ["2", "worker1", "worker2"]
465+
466+
467+
def test_job_variant_weights(hq_env: HqEnv, tmp_path):
468+
hq_env.start_server()
469+
tmp_path.joinpath("job.toml").write_text(
470+
"""
471+
[[task]]
472+
id = 0
473+
command = ["bash", "-c", "echo ${HQ_NUM_NODES}; cat ${HQ_NODE_FILE}"]
474+
[[task.request]]
475+
resources = {"cpus" = 2}
476+
weight = 2
477+
[[task.request]]
478+
resources = {"cpus" = 1, "gpus" = 2}
479+
weight = 0.5
480+
"""
481+
)
482+
hq_env.command(["job", "submit-file", "job.toml"])
483+
table = hq_env.command(["task", "info", "1", "0"], as_table=True)
484+
table.check_row_value(
485+
"Resources",
486+
"# Variant 1\ncpus: 2 compact\n[weight: 2]\n# Variant 2\ncpus: 1 compact\ngpus: 2 compact\n[weight: 0.5]",
487+
)

0 commit comments

Comments
 (0)