Skip to content

Commit

Permalink
Version 0.8.42
Browse files Browse the repository at this point in the history
Added `get_active_jobs` API and docs.  Closes #261.
  • Loading branch information
jhuckaby committed Feb 14, 2020
1 parent 23c3ba2 commit e95d6db
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,30 @@ The CPU is measured as percentage of one CPU core, so 100 means that a full CPU

The memory usage is measured in bytes. The current value can be found in `current`, and the minimum (`min`) and maximum (`max`) readings are also tracked. To compute the average, divide the `total` value by the `count`.

### get_active_jobs

```
/api/app/get_active_jobs/v1
```

This fetches status for **all active** jobs, and returns them all at once. It takes no parameters (except an [API Key](#api-keys) of course). The response format is as follows:

```js
{
"code": 0,
"jobs": {
"jk6lmar4c01": {
...
},
"jk6lmar4d04": {
...
}
}
}
```

In addition to the [Standard Response Format](#standard-response-format), the response object will contain a `jobs` object. This object will have zero or more nested objects, each representing one active job. The inner property names are the Job IDs, and the contents are the status, progress, and other information about the active job. For details on the job objects, see the [get_job_status](#get_job_status) API call above, as the parameters of each job will be the same as that API.

### update_job

```
Expand Down
17 changes: 17 additions & 0 deletions lib/api/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,23 @@ module.exports = Class.create({
); // async.series
} ); // job get
} ); // session
},

api_get_active_jobs: function(args, callback) {
// get all active jobs in progress
var self = this;
var params = Tools.mergeHashes( args.params, args.query );
if (!this.requireMaster(args, callback)) return;

this.loadSession(args, function(err, session, user) {
if (err) return self.doError('session', err.message, callback);
if (!self.requireValidUser(session, user, callback)) return;

return callback({
code: 0,
jobs: self.getAllActiveJobs()
});
} ); // session
}

} );
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Cronicle",
"version": "0.8.41",
"version": "0.8.42",
"description": "A simple, distributed task scheduler and runner with a web based UI.",
"author": "Joseph Huckaby <[email protected]>",
"homepage": "https://github.com/jhuckaby/Cronicle",
Expand Down

0 comments on commit e95d6db

Please sign in to comment.