Skip to content

Job

Jobs are what DRP uses to track the state of running individual tasks on a machine. There can be at most one current job for a machine at any given time.

Field Definition
Action Action contains the expanded Action information if this Job was created as part of Action processing.
Action/Command Command is the command within the plugin
Action/CommandSet CommandSet is the scope of the commands (usually the model's Prefix) e.g. machines
Action/Model Model is the object being acted upon
Action/Params Params contains additional parameters that the action should operate from
Action/Plugin Plugin is the handler of this action
Archived Archived indicates whether the complete log for the job can be
retrieved via the API. If Archived is true, then the log cannot
be retrieved.

required: true
BootEnv The bootenv that the task was created in.
read only: true
Context Context is the context the job was created to run in.
Current Whether the job is the "current one" for the machine or if it has been superceded.

required: true
CurrentIndex The current index is the machine CurrentTask that created this job.

required: true
read only: true
EndTime The time the job failed or finished.
ExitState The final disposition of the job.
Can be one of "reboot","poweroff","stop", or "complete"
Other substates may be added as time goes on
ExtraClaims/Action Action is the action taken in the space. e.g. get, list
Can be comma separated list or *
ExtraClaims/Scope Scope is the object space. e.g. machines
Can be comma separated list or *
ExtraClaims/Specific Specific is the id of the object in the object space. e.g. machine uuid
Can be comma separated list or *
Independent Independent indicates that this Job was created to track something besides a task being
executed by an agent. Most of the task state sanity checking performed by the job lifecycle
checking will be skipped -- in particular, the job need not be associated with a Workorder or a Machine,
it will be permitted to have multiple simultaneous Jobs in flight for the same Target, and State will
be ignored for job cleanup purposes.
Machine The machine the job was created for. This field must be the UUID of the machine.
It must be set if Independent is false.
swagger:strfmt uuid
Meta Meta contains the meta data of the object.

The type of this field is a key / value map/dictionary.
The key type is string.
The value type is also string.

The general content of the field is undefined and can be an arbritary store.
There are some common known keys:

color - The color the UX uses when displaying
icon - The icon the UX uses when displaying
* title - The UX uses this for additional display information. Often the source of the object.

Specific Object types use additional meta data fields. These are described at:
https://docs.rackn.io/stable/redirect/?ref=rs_object_metadata
NextIndex The next task index that should be run when this job finishes. It is used
in conjunction with the machine CurrentTask to implement the server side of the
machine agent state machine.

required: true
read only: true
Previous The UUID of the previous job to run on this machine.
swagger:strfmt uuid
ResultErrors ResultErrors is a list of error from the task. This is filled in by the
task if it is written to do so. This tracks results without requiring
job logs.
Stage The stage that the task was created in.
read only: true
StartTime The time the job started running.
State The state the job is in. Must be one of "created", "running", "failed", "finished", "incomplete"
required: true
TargetKey TargetKey is the Key of the Object that an Independent job was invoked against.
It may be empty if TargetPrefix is "system".
TargetPrefix TargetPrefix is the Prefix of the Object that an Independent job was invoked against.
It must be set if Independent is true.
Task The task the job was created for. This will be the name of the task.
read only: true
Uuid The UUID of the job. The primary key.
required: true
swagger:strfmt uuid
WorkOrder The work order the job was created for. This field must be the UUID of the work order.
It must be set if Independent is false and the job is being run on behalf of a WorkOrder.
swagger:strfmt uuid
Workflow The workflow that the task was created in.
read only: true
State Definition
created This is the state that all freshly-created jobs start at.
running Jobs are automatically transitioned to this state by the machine agent when it starts executing this job's actions.
failed Jobs are transitioned to this state when they fail for any reason.
finished Jobs are transitioned to this state when all their actions have completed successfully.
incomplete Jobs are transitioned to this state when an action signals that the job must stop and be restarted later as part of its action.

| ExitState | Definition | | reboot | Indicates that the job stopped executing due to the machine needing to be rebooted. | poweroff | Indicates that the job stopped executing because the machine needs to be powered off. | stop | Indicates that the job stopped because an action indicated that it should stop executing. | complete | Indicates that the job finished.

Job Actions

Once a Job has been created and transitioned to the running state, the machine agent will request that the Templates in the Task for the job be rendered for the Machine and placed into JobActions. JobActions have the following fields:

Field Definition
Name The name of the JobAction. It is present for informational and troubleshooting purposes, and the name does not effect how the JobAction is handled.
Content The result of rendering a specific Template from a Task against a Machine.
Path If present, the Content will be written to the location indicated by this field, replacing any previous file at that location. If Path is not present or empty, then the Contents will be treated as a shell script and be executed.