Skip to content

Commit

Permalink
traverser: set default job duration based on current time left
Browse files Browse the repository at this point in the history
Problem: When a job is submitted without a duration specified and
the current graph has a limited duration, the jobspec duration is set
to the graph duration. This is not ideal for any job submitted after
the first instant of the graph's lifetime, since the job's expiration
will be set after the instance has expired.

Ideally, jobs without a specified duration should inherit the instance
expiration not its duration. Do the next best thing and set the
duration to the instance expiration (graph_end) - now, which should
result in the expiration of the job matching that of the instance.

Fixes #1103
  • Loading branch information
grondo committed Nov 3, 2023
1 parent 310cc2d commit 86a820a
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 86a820a

Please sign in to comment.