Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Fix job consolidation in store
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothiraldan committed Apr 1, 2016
1 parent c1091c7 commit c2a4559
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion app/jobs/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ export function GetJobDetails(job_id) {
}

export function JobReturn(job_id, job) {
store.set(['jobs', job_id], JobEventToJobStore(job.data));
let path = ['jobs', job_id];
let job_to_store = JobEventToJobStore(job.data);
if(store.exists(path)) {
store.merge(path, job_to_store);
} else {
store.set(path, job_to_store);
}
}

export function UpdateModuleFunctionList(job_id, minion, job) {
Expand Down Expand Up @@ -91,6 +97,18 @@ export function RunJob(matcher, minions, module_function, args, add_to_runned_jo
store.apply(['session', 'runned_jobs'], _.partial(last10, job_id));
}

// Add to store informations we have
let job = {Function: module_function, jid: job_id,
Target: minions, Arguments: args,
'Target-type': matcher}

let path = ['jobs', job_id]
if(store.exists(path)) {
store.merge(path, job);
} else {
store.set(path, job);
}

return job_id;
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export var JobEventToJobStore = function(job) {
'StartTime': moment(job['_stamp'], moment.ISO_8601).unix(), 'Target': job['tgt'],
'Target-type': job['tgt_type'], 'Arguments': ArgParser(job['arg']),
'Minions': job['minions'], 'Return': job['return']}
return _.omit(new_job, _.isUndefined);
return _.omitBy(new_job, _.isUndefined);
}

export var ArgSpecParser = function(argspec) {
Expand Down

0 comments on commit c2a4559

Please sign in to comment.