Skip to content

Commit 7d63065

Browse files
authored
Merge pull request #1104 from grondo/issue#1103
traverser: fix default job duration when no duration specified
2 parents 8da547c + 218f7ec commit 7d63065

File tree

2 files changed

+51
-8
lines changed

2 files changed

+51
-8
lines changed

resource/traversers/dfu.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ int dfu_traverser_t::run (Jobspec::Jobspec &jobspec,
290290
}
291291

292292
int rc = -1;
293-
int64_t graph_end = graph_duration.graph_end.time_since_epoch ().count ();
293+
int64_t graph_end = std::chrono::duration_cast<std::chrono::seconds>
294+
(graph_duration.graph_end
295+
.time_since_epoch ()).count ();
294296
detail::jobmeta_t meta;
295297
vtx_t root = get_graph_db ()->metadata.roots.at (dom);
296298
bool x = detail::dfu_impl_t::exclusivity (jobspec.resources, root);

t/t4011-match-duration.t

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,58 @@ test_description='Test that parent duration is inherited according to RFC14'
99
#
1010
test_under_flux 1
1111

12-
test_expect_success HAVE_JQ 'parent duration is inherited when duration=0' '
12+
export FLUX_URI_RESOLVE_LOCAL=t
13+
14+
# Ensure fluxion modules are loaded under flux-alloc(1)
15+
test_expect_success 'set FLUX_RC_EXTRA so Fluxion modules are loaded under flux-alloc' '
16+
mkdir rc1.d &&
17+
cat <<-EOF >rc1.d/rc1-fluxion &&
18+
flux module unload -f sched-simple
19+
flux module load sched-fluxion-resource
20+
flux module load sched-fluxion-qmanager
21+
EOF
22+
mkdir rc3.d &&
23+
cat <<-EOF >rc3.d/rc3-fluxion &&
24+
flux module remove -f sched-fluxion-qmanager
25+
flux module remove -f sched-fluxion-resource
26+
flux module load sched-simple
27+
EOF
28+
chmod +x rc1.d/rc1-fluxion rc3.d/rc3-fluxion &&
29+
export FLUX_RC_EXTRA=$(pwd)
30+
'
31+
test_expect_success 'load fluxion modules in parent instance' '
32+
flux module remove sched-simple &&
33+
load_resource &&
34+
load_qmanager &&
35+
test_debug "flux dmesg -H | grep version"
36+
'
37+
test_expect_success HAVE_JQ 'parent expiration is inherited when duration=0' '
1338
cat >get_R.sh <<-EOT &&
1439
#!/bin/sh
15-
1640
flux job info \$FLUX_JOB_ID R
1741
EOT
1842
chmod +x get_R.sh &&
19-
out=$(flux run -t20s -n1 flux start flux run -n1 ./get_R.sh) &&
20-
echo "$out" | jq -e ".execution.expiration - .execution.starttime <= 20" &&
21-
out=$(flux run -t30s -n1 flux start flux run -n1 ./get_R.sh) &&
22-
echo "$out" | jq -e ".execution.expiration - .execution.starttime <= 30"
43+
jobid=$(flux alloc -n1 -t5m --bg) &&
44+
test_debug "flux proxy $jobid flux dmesg -H | grep version" &&
45+
expiration=$(flux job info $jobid R | jq .execution.expiration) &&
46+
duration=$(flux job info $jobid R \
47+
| jq ".execution | .expiration - .starttime") &&
48+
test_debug "echo expiration of alloc job is $expiration duration=$duration" &&
49+
R1=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
50+
exp1=$(echo "$R1" | jq .execution.expiration) &&
51+
d1=$(echo "$R1" | jq ".execution | .expiration - .starttime") &&
52+
test_debug "echo expiration of job is $exp1 duration=$d1" &&
53+
echo $exp1 | jq ". == $expiration" &&
54+
sleep 1 &&
55+
R2=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
56+
exp2=$(echo "$R2" | jq .execution.expiration) &&
57+
d2=$(echo "$R2" | jq ".execution | .expiration - .starttime") &&
58+
test_debug "echo expiration of second job is $exp2 duration=$d2" &&
59+
echo $exp2 | jq ". == $expiration" &&
60+
flux shutdown --quiet $jobid
61+
'
62+
test_expect_success 'unload fluxion modules' '
63+
remove_qmanager &&
64+
remove_resource
2365
'
24-
2566
test_done

0 commit comments

Comments
 (0)