Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline status bug #1408

Merged
merged 2 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/pipeline-driver/lib/state/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class DB {
return this._db.jobs.updateResult(options);
}

updateStatus(options) {
return this._db.jobs.updateStatus(options);
updateStatus(options, updateOnlyActive) {
return this._db.jobs.updateStatus(options, updateOnlyActive);
}

fetchStatus(options) {
Expand Down
8 changes: 6 additions & 2 deletions core/pipeline-driver/lib/state/state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ class StateManager {

async setJobStatus(options) {
return this._etcd.jobs.status.update(options, (oldItem) => {
if (oldItem.status !== DriverStates.STOPPED && oldItem.status !== DriverStates.PAUSED) {
if (this._isActiveStatus(oldItem.status)) {
const data = { ...oldItem, ...options };
db.updateStatus(data);
db.updateStatus(data, true);
return data;
}
return null;
Expand All @@ -198,6 +198,10 @@ class StateManager {
});
}

_isActiveStatus(status) {
return status !== DriverStates.STOPPED && status !== DriverStates.PAUSED;
}

getJobStatus(options) {
return db.fetchStatus(options);
}
Expand Down
Loading