This commit is contained in:
Alex Dadgar
2017-07-06 15:19:07 -07:00
parent 65abc9ae41
commit 4e4c4a0f46
3 changed files with 10 additions and 8 deletions

View File

@@ -416,10 +416,10 @@ func (j *Job) Stable(args *structs.JobStabilityRequest, reply *structs.JobStabil
return fmt.Errorf("job %q at version %d not found", args.JobID, args.JobVersion)
}
// Commit this evaluation via Raft
// Commit this stability request via Raft
_, modifyIndex, err := j.srv.raftApply(structs.JobStabilityRequestType, args)
if err != nil {
j.srv.logger.Printf("[ERR] nomad.job: Eval create failed: %v", err)
j.srv.logger.Printf("[ERR] nomad.job: Job stability request failed: %v", err)
return err
}

View File

@@ -873,13 +873,15 @@ func (s *StateStore) jobVersionByID(txn *memdb.Txn, ws *memdb.WatchSet, id strin
return all, nil
}
// JobByIDAndVersion returns the job identified by its ID and Version
// JobByIDAndVersion returns the job identified by its ID and Version. The
// passed watchset may be nil.
func (s *StateStore) JobByIDAndVersion(ws memdb.WatchSet, id string, version uint64) (*structs.Job, error) {
txn := s.db.Txn(false)
return s.jobByIDAndVersionImpl(ws, id, version, txn)
}
// jobByIDAndVersionImpl returns the job identified by its ID and Version
// jobByIDAndVersionImpl returns the job identified by its ID and Version. The
// passed watchset may be nil.
func (s *StateStore) jobByIDAndVersionImpl(ws memdb.WatchSet, id string, version uint64, txn *memdb.Txn) (*structs.Job, error) {
watchCh, existing, err := txn.FirstWatch("job_version", "id", id, version)
if err != nil {

View File

@@ -821,7 +821,7 @@ This endpoint returns a single job's most recent deployment.
| Method | Path | Produces |
| ------ | ----------------------------- | -------------------------- |
| `GET` | `/v1/job/:job_id/deployment` | `application/json` |
| `GET` | `/v1/job/:job_id/deployment` | `application/json` |
The table below shows this endpoint's support for
[blocking queries](/api/index.html#blocking-queries) and
@@ -1070,7 +1070,7 @@ The table below shows this endpoint's support for
- `JobID` `(string: <required>)` - Specifies the ID of the job (as specified
in the job file during submission). This is specified as part of the path.
- `JobVersion` `(integer: 0) - Specifies the job version to revert to.
- `JobVersion` `(integer: 0)` - Specifies the job version to revert to.
- `EnforcePriorVersion` `(integer: nil)` - Optional value specifying the current
job's version. This is checked and acts as a check-and-set value before
@@ -1111,7 +1111,7 @@ This endpoint sets the job's stability.
| Method | Path | Produces |
| ------- | -------------------------- | -------------------------- |
| `POST` | `/v1/job/:job_id/stable` | `application/json` |
| `POST` | `/v1/job/:job_id/stable` | `application/json` |
The table below shows this endpoint's support for
[blocking queries](/api/index.html#blocking-queries) and
@@ -1126,7 +1126,7 @@ The table below shows this endpoint's support for
- `JobID` `(string: <required>)` - Specifies the ID of the job (as specified
in the job file during submission). This is specified as part of the path.
- `JobVersion` `(integer: 0) - Specifies the job version to set the stability on.
- `JobVersion` `(integer: 0)` - Specifies the job version to set the stability on.
- `Stable` `(bool: false)` - Specifies whether the job should be marked as
stable or not.