NomadClient.Api.Jobs (nomad_client v0.12.4)

API calls for all endpoints tagged Jobs.

Link to this section Summary

Functions

dispatches a new instance of a parameterized job

creates a new evaluation for the given job. This can be used to force run the scheduling logic if necessary

forces a new instance of the periodic job. A new instance will be created even if it violates the job's prohibit_overlap settings. As such, this should be only used to immediately run a periodic job

reads information about a single job for its specification and status

reads information about a single job's allocations

lists a single job's deployments

reads information about a single job's evaluations

get a single job's most recent deployment

reads scale information about a job

reads summary information about a job

reads information about all versions of a job

lists all known jobs in the system registered with Nomad

parse a HCL jobspec and produce the equivalent JSON encoded job

invokes a dry-run of the scheduler for the job

creates (aka "registers") a new job in the system

performs a scaling action against a job. Currently, this endpoint supports scaling the count for a task group

deregisters a job, and stops all allocations part of it

registers a new job or updates an existing job

validate object structs, fields, and types

Link to this section Functions

Link to this function

dispatch_job(connection, job_id, job_dispatch_request, opts \\ [])

Specs

dispatches a new instance of a parameterized job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • job_dispatch_request (JobDispatchRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

evaluate_job(connection, job_id, job_evaluate_request, opts \\ [])

Specs

creates a new evaluation for the given job. This can be used to force run the scheduling logic if necessary

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • job_evaluate_request (JobEvaluateRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

force_new_periodic_instance(connection, job_id, opts \\ [])

Specs

force_new_periodic_instance(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.PeriodicForceResponse.t()} | {:error, Tesla.Env.t()}

forces a new instance of the periodic job. A new instance will be created even if it violates the job's prohibit_overlap settings. As such, this should be only used to immediately run a periodic job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_job(connection, job_id, opts \\ [])

Specs

get_job(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.Job.t()} | {:error, Tesla.Env.t()}

reads information about a single job for its specification and status

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_allocations(connection, job_id, opts \\ [])

Specs

get_job_allocations(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [NomadClient.Model.AllocationListStub.t()]} | {:error, Tesla.Env.t()}

reads information about a single job's allocations

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests
    • :all (boolean()): Specifies whether should include * from a previously registered job with the same ID. This is possible if the job is deregistered and reregistered.

      Returns

, ...]} on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_deployments(connection, job_id, opts \\ [])

Specs

get_job_deployments(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [NomadClient.Model.Deployment.t()]} | {:error, Tesla.Env.t()}

lists a single job's deployments

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests
    • :all (boolean()): Specifies whether should include * from a previously registered job with the same ID. This is possible if the job is deregistered and reregistered.

      Returns

, ...]} on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_evaluations(connection, job_id, opts \\ [])

Specs

get_job_evaluations(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [NomadClient.Model.Evaluation.t()]} | {:error, Tesla.Env.t()}

reads information about a single job's evaluations

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

, ...]} on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_latest_deployment(connection, job_id, opts \\ [])

Specs

get_job_latest_deployment(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.Deployment.t()} | {:error, Tesla.Env.t()}

get a single job's most recent deployment

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_scale_status(connection, job_id, opts \\ [])

Specs

get_job_scale_status(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.JobScaleStatusResponse.t()} | {:error, Tesla.Env.t()}

reads scale information about a job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_summary(connection, job_id, opts \\ [])

Specs

get_job_summary(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.JobSummary.t()} | {:error, Tesla.Env.t()}

reads summary information about a job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_job_versions(connection, job_id, opts \\ [])

Specs

get_job_versions(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.JobVersionsResponse.t()} | {:error, Tesla.Env.t()}

reads information about all versions of a job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_jobs(connection, opts \\ [])

Specs

get_jobs(Tesla.Env.client(), keyword()) ::
  {:ok, [NomadClient.Model.JobListStub.t()]} | {:error, Tesla.Env.t()}

lists all known jobs in the system registered with Nomad

Parameters

  • connection (NomadClient.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests
    • :prefix (String.t): Specifies a string to filter jobs on based on an index prefix. This is specified as a query string parameter

      Returns

, ...]} on success {:error, Tesla.Env.t} on failure

Link to this function

parse_job_hcl(connection, jobs_parse_request, opts \\ [])

Specs

parse a HCL jobspec and produce the equivalent JSON encoded job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • jobs_parse_request (JobsParseRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

plan_job(connection, job_id, job_plan_request, opts \\ [])

Specs

invokes a dry-run of the scheduler for the job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • job_plan_request (JobPlanRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

register_job(connection, register_job_request, opts \\ [])

Specs

creates (aka "registers") a new job in the system

Parameters

  • connection (NomadClient.Connection): Connection to server
  • register_job_request (RegisterJobRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

revert_job(connection, job_id, job_revert_request, opts \\ [])

Specs

reverts the job to an older version

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • job_revert_request (JobRevertRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

scale_task_group(connection, job_id, scaling_request, opts \\ [])

Specs

performs a scaling action against a job. Currently, this endpoint supports scaling the count for a task group

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • scaling_request (ScalingRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

set_job_stability(connection, job_id, job_stability_request, opts \\ [])

Specs

sets the job's stability

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • job_stability_request (JobStabilityRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

stop_job(connection, job_id, opts \\ [])

Specs

deregisters a job, and stops all allocations part of it

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests
    • :purge (boolean()): Specifies that the job should stopped and purged immediately. This means the job will not be queryable after being stopped. If not set, the job will be purged by the garbage collector

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

update_job(connection, job_id, register_job_request, opts \\ [])

Specs

registers a new job or updates an existing job

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_id (String.t): job id
  • register_job_request (RegisterJobRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

validate_job(connection, job_validate_request, opts \\ [])

Specs

validate object structs, fields, and types

Parameters

  • connection (NomadClient.Connection): Connection to server
  • job_validate_request (JobValidateRequest):
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure