Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Unreleased

### Fixes
* Fixes Multi-node tasks defined in job file.

## v0.25.0

### Breaking change
Expand Down
2 changes: 0 additions & 2 deletions crates/hyperqueue/src/client/commands/submit/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,6 @@ pub async fn submit_computation(
.unwrap_or_else(|| "job".to_string())
};

// Force task_dir for multi node tasks (for a place where to create node file)
let task_dir = task_dir | (resources.n_nodes > 0);
let resources = ResourceRequestVariants::new(smallvec![resources]);

let args: Vec<BString> = commands.into_iter().map(|arg| arg.into()).collect();
Expand Down
2 changes: 1 addition & 1 deletion crates/hyperqueue/src/worker/start/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub(super) fn build_program_task(

pin_program(&mut program, build_ctx.allocation(), pin_mode, &build_ctx)?;

let task_dir = if task_dir {
let task_dir = if task_dir || !build_ctx.node_list().is_empty() {
let task_dir = TempDir::with_prefix_in("t", &build_ctx.worker_configuration().work_dir)
.map_err(|error| {
format!(
Expand Down
20 changes: 20 additions & 0 deletions tests/test_jobfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,23 @@ def test_job_file_stream(hq_env: HqEnv, tmp_path):
wait_for_job_state(hq_env, 1, "FINISHED")
result = hq_env.command(["output-log", "output", "cat", "1", "stdout"])
assert result == "Hello\n"


def test_job_file_multinode(hq_env: HqEnv, tmp_path):
hq_env.start_server()
hq_env.start_worker()
hq_env.start_worker()
tmp_path.joinpath("job.toml").write_text(
"""
[[task]]
id = 0
command = ["bash", "-c", "echo ${HQ_NUM_NODES}; cat ${HQ_NODE_FILE}"]
[[task.request]]
n_nodes = 2
"""
)
hq_env.command(["job", "submit-file", "job.toml"])
wait_for_job_state(hq_env, 1, "FINISHED")
with open(default_task_output(1)) as f:
lines = sorted(f.read().rstrip().split("\n"))
assert lines == ["2", "worker1", "worker2"]
Loading