Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traverser: fix default job duration when no duration specified #1104

Merged
merged 2 commits into from
Nov 7, 2023
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
4 changes: 3 additions & 1 deletion resource/traversers/dfu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ int dfu_traverser_t::run (Jobspec::Jobspec &jobspec,
}

int rc = -1;
int64_t graph_end = graph_duration.graph_end.time_since_epoch ().count ();
int64_t graph_end = std::chrono::duration_cast<std::chrono::seconds>
(graph_duration.graph_end
.time_since_epoch ()).count ();
detail::jobmeta_t meta;
vtx_t root = get_graph_db ()->metadata.roots.at (dom);
bool x = detail::dfu_impl_t::exclusivity (jobspec.resources, root);
Expand Down
55 changes: 48 additions & 7 deletions t/t4011-match-duration.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,58 @@ 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

# Ensure fluxion modules are loaded under flux-alloc(1)
test_expect_success 'set FLUX_RC_EXTRA so Fluxion modules are loaded under flux-alloc' '
mkdir rc1.d &&
cat <<-EOF >rc1.d/rc1-fluxion &&
flux module unload -f sched-simple
flux module load sched-fluxion-resource
flux module load sched-fluxion-qmanager
EOF
mkdir rc3.d &&
cat <<-EOF >rc3.d/rc3-fluxion &&
flux module remove -f sched-fluxion-qmanager
flux module remove -f sched-fluxion-resource
flux module load sched-simple
EOF
chmod +x rc1.d/rc1-fluxion rc3.d/rc3-fluxion &&
export FLUX_RC_EXTRA=$(pwd)
'
test_expect_success 'load fluxion modules in parent instance' '
flux module remove sched-simple &&
load_resource &&
load_qmanager &&
test_debug "flux dmesg -H | grep version"
'
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) &&
test_debug "flux proxy $jobid flux dmesg -H | grep version" &&
expiration=$(flux job info $jobid R | jq .execution.expiration) &&
duration=$(flux job info $jobid R \
| jq ".execution | .expiration - .starttime") &&
test_debug "echo expiration of alloc job is $expiration duration=$duration" &&
R1=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
exp1=$(echo "$R1" | jq .execution.expiration) &&
d1=$(echo "$R1" | jq ".execution | .expiration - .starttime") &&
test_debug "echo expiration of job is $exp1 duration=$d1" &&
echo $exp1 | jq ". == $expiration" &&
sleep 1 &&
R2=$(flux proxy $jobid flux run -n1 ./get_R.sh) &&
exp2=$(echo "$R2" | jq .execution.expiration) &&
d2=$(echo "$R2" | jq ".execution | .expiration - .starttime") &&
test_debug "echo expiration of second job is $exp2 duration=$d2" &&
echo $exp2 | jq ". == $expiration" &&
flux shutdown --quiet $jobid
'
test_expect_success 'unload fluxion modules' '
remove_qmanager &&
remove_resource
'

test_done
Loading