Skip to content

Periodic Parameterized Batch behavior #24311

Open
@EtienneBruines

Description

@EtienneBruines

Nomad version

Nomad v1.9.1
BuildDate 2024-10-21T09:00:50Z
Revision d9ec23f

Operating system and Environment details

Ubuntu 22.04.5 LTS

Issue

A batch job that is both parameterized and periodic cannot be run. When invoking it as parameterized, it results in something like this:

# nomad job status sync-periodically-or-invoked/dispatch-1730190526-56bb20a5                                                                                                                                                        [8:33:17]

ID                   = sync-periodically-or-invoked/dispatch-1730190526-56bb20a5
Name                 = sync-periodically-or-invoked/dispatch-1730190526-56bb20a5
Submit Date          = 2024-10-29T08:28:46Z
Type                 = batch
Priority             = 50
Datacenters          = dc1
Namespace            = default
Node Pool            = default
Status               = running
Periodic             = true
Parameterized        = false
Next Periodic Launch = 2024-10-30T02:30:00Z (17h56m24s from now)

When trying to force-launch it via the CLI: nomad job periodic force`

Error forcing periodic job "sync-periodically-or-invoked": Unexpected response code: 500 (rpc error: force launch for job "sync-periodically-or-invoked" failed: can't force run non-tracked job "sync-periodically-or-invoked" (default))

Reproduction steps

  • Create the job using the example job file (this step will succeed)
  • Try to run it via periodic force
  • Or try to run it via dispatch

Expected Result

The job being able to run periodically (e.g. a daily sync) as well as on-demand (e.g. as a response to a webhook).

If this use-case is not supported (which would be sad), then at least the creating of such a parameterized periodic job should be blocked.

Actual Result

Neither of use-cases work - the job is not run at all.

Job file (if appropriate)

job "sync-periodically-or-invoked" {
  datacenters = [ "dc1" ]
  type = "batch"

  periodic {
    crons = [
      "30 2 * * * *" // At 2:30 AM every day
    ]
  }

  parameterized {
    payload = "optional"
  }

  group "sync" {
    task "sync" {
      driver = "docker"

      config {
        image = "hello-world"
      }
    }
  }
}

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

Update

I do seem to be able to periodic-force launch the parameterized job, resulting in some kind of a job like this:

ID            = sync-periodically-or-invoked/dispatch-1730190526-56bb20a5/periodic-1730191323
Name          = sync-periodically-or-invoked/dispatch-1730190526-56bb20a5/periodic-1730191323
Submit Date   = 2024-10-29T08:42:03Z
Type          = batch
Priority      = 50
Datacenters   = dc1
Namespace     = default
Node Pool     = default
Status        = running
Periodic      = false
Parameterized = false

Summary
Task Group  Queued  Starting  Running  Failed  Complete  Lost  Unknown
sync        0       0         1        0       0         0     0

Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created  Modified
a78d346b  568c32eb  sync        0        run      running  24s ago  8s ago

Which does not show up in the web UI.

I can't argue against that use-case (creating a number of cronjobs, each with different dispatched payloads), but it's not quite what I'd expect, nor does the UI support that either.

Metadata

Metadata

Assignees

Labels

hcc/jirastage/acceptedConfirmed, and intend to work on. No timeline committment though.theme/batchIssues related to batch jobs and schedulingtheme/docsDocumentation issues and enhancementstheme/parameterizedparameterized batch jobstheme/periodictype/bug

Type

No type

Projects

Status

Needs Roadmapping

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions