Skip to content

Commit

Permalink
Merge 48b1444 into 8da547c
Browse files Browse the repository at this point in the history
  • Loading branch information
grondo authored Nov 3, 2023
2 parents 8da547c + 48b1444 commit 641a82a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion resource/traversers/dfu_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ struct jobmeta_t {
jobid = id;
alloc_type = alloc;
int64_t g_duration = std::chrono::duration_cast<std::chrono::seconds>
(graph_duration.graph_end - graph_duration.graph_start).count ();
(graph_duration.graph_end -
std::chrono::system_clock::now()).count ();

if (g_duration <= 0) {
errno = EINVAL;
Expand Down
22 changes: 16 additions & 6 deletions t/t4011-match-duration.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,27 @@ test_description='Test that parent duration is inherited according to RFC14'
#
test_under_flux 1

test_expect_success HAVE_JQ 'parent duration is inherited when duration=0' '
export FLUX_URI_RESOLVE_LOCAL=t

test_expect_success HAVE_JQ 'parent expiration is inherited when duration=0' '
cat >get_R.sh <<-EOT &&
#!/bin/sh
flux job info \$FLUX_JOB_ID R
EOT
chmod +x get_R.sh &&
out=$(flux run -t20s -n1 flux start flux run -n1 ./get_R.sh) &&
echo "$out" | jq -e ".execution.expiration - .execution.starttime <= 20" &&
out=$(flux run -t30s -n1 flux start flux run -n1 ./get_R.sh) &&
echo "$out" | jq -e ".execution.expiration - .execution.starttime <= 30"
jobid=$(flux alloc -n1 -t5m --bg) &&
expiration=$(flux job info $jobid R | jq .execution.expiration) &&
test_debug "echo expiration of alloc job is $expiration" &&
R1=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
exp1=$(echo "$R1" | jq .execution.expiration) &&
test_debug "echo expiration of job is $exp1" &&
echo $exp1 | jq ". == $expiration" &&
sleep 1 &&
R1=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
exp1=$(echo "$R1" | jq .execution.expiration) &&
test_debug "echo expiration of second job is $exp1" &&
echo $exp1 | jq ". == $expiration" &&
flux shutdown --quiet $jobid
'

test_done

0 comments on commit 641a82a

Please sign in to comment.