From the nomad-skeleton-driver-plugin I did a simple test by changing the job configuration from batch
to service
and putting the process to sleep for 10 seconds in order to simulate a running service.
job "example" {
datacenters = ["dc1"]
type = "service" # change from batch to service
...
func (d *HelloDriverPlugin) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) {
...
execCmd := &executor.ExecCommand{
Args: []string{"-c", `sleep 10`}, // fake 10 seconds running service
...
The task runs and is rescheduled after completion, with exit code 0, as if the nomad client did not report the correct status.
I would like to have an example of how services
should be executed and completed correctly and what is the programmatic difference with the batch
implementation?
Thanks in advance.