hashicorp / hashicorp/nomad

Batch Periodic job running after one time schedule

Open
#5,495 1 comment 3 reactions 0 assignees View on GitHub
theme/batch theme/scheduling type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version
Nomad v0.8.4 (dbee1d7d051619e90a809c23cf7e55750900742a)

### Operating system and Environment details
Ubuntu 18.04

### Issue
I have submitted a batch job with a one time periodic CRON schedule. As you can see thats scheduled to run at 03:06PM on March 29th 2019, so there is no follow up run

```hcl
type = "batch"
periodic {
#https://github.com/gorhill/cronexpr#implementation
# sec min hour dayOfMonth month dayOfWeek year
cron = "0 06 15 29 MAR * 2019"
time_zone = "America/New_York"
}
```

After it runs at the defined time, the batch job remains running and its next periodic launch is bugged.

```console
# nomad status batch-job-in-question
Submit Date = 2019-03-29T15:04:21-04:00
Type = batch
Status = running
Periodic = true
Parameterized = false
Next Periodic Launch = (-2562047h47m16.854775808s from now)
```

Will it be possible that jobs, with absolute cron schedule (including the year) be treated as a one time batch job and marked as "dead" after success?

When I say "one time batch job" I refer to the functionality of submitting a batch job without specifying the periodic stanza.

Another possibility is check the next periodic launch and if its non existent like in this case, mark the job as dead.

> What I am trying to do here is, schedule a one time batch job but for the future that does not repeat.

### Reproduction steps
run any periodic job with a one time schedule like
```hcl
type = "batch"
periodic {
#https://github.com/gorhill/cronexpr#implementation
# sec min hour dayOfMonth month dayOfWeek year
cron = "0 06 15 29 MAR * 2019"
time_zone = "America/New_York"
}

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named in the report. Start by reproducing the issue with the provided one-time periodic HCL schedule and inspect the periodic batch-job handling. Done means the job is marked dead after its single successful run and no invalid next periodic launch is reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.