Skip to content

Commit

Permalink
Merge pull request #23 from Kitware/jobs-endpoint
Browse files Browse the repository at this point in the history
fix(io): added jobs endpoint
  • Loading branch information
TristanWright committed Feb 26, 2016
2 parents 6b32055 + 6705bcd commit 2bf072a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/IO/Girder/HpcCloudEndpoints/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import aws from './aws';
import clusters from './clusters';
import jobs from './jobs';
import projects from './projects';
import simulations from './simulations';
import taskflows from './taskflows';

export default [
aws,
clusters,
jobs,
projects,
simulations,
taskflows,
Expand Down
62 changes: 62 additions & 0 deletions src/IO/Girder/HpcCloudEndpoints/jobs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
export default function({client, filterQuery, mustContain, busy}) {
return {
// GET /jobs List all jobs for a given user
getJobs(offset, limit){
if (offset && limit) {
return busy(client._.get(`/jobs?offset=${offset}&limit=${limit}`));
} else if (offset) {
return busy(client._.get(`/jobs?offset=${offset}`));
} else if (limit) {
return busy(client._.get(`/jobs?limit=${limit}`));
}

return busy(client._.get('/jobs'));
},

// POST /jobs Create a new job
createJob(params){
return busy(client._.post('/jobs', params));
},

// GET /jobs/{id} Get a job
getJob(id){
return busy(client._.post(`/jobs/${id}`));
},

// PATCH /jobs/{id} Update the job
updateJob(id, params) {
return busy(client._.patch(`/jobs/${id}`, params));
},

// DELETE /jobs/{id} Delete a job
deleteJob(id) {
return busy(client._.delete(`/jobs/${id}`));
},

// GET /jobs/{id}/log Get log entries for job
getJobLog(id, offset){
if (offset) {
return busy(client._.get(`/jobs/${id}/log?offset=${offset}`));
}
return busy(client._.get(`/jobs/${id}/log`));
},

// GET /jobs/{id}/output Get output entries for job
getJobOutput(id, path, offset){
if (offset) {
return busy(client._.get(`/jobs/${id}/output?path=${path}&offset=${offset}`));
}
return busy(client._.get(`/jobs/${id}/output?path=${path}`));
},

// GET /jobs/{id}/status Get the status of a job
getJobStatus(id){
return busy(client._.get(`/jobs/${id}/status`));
},

// PUT /jobs/{id}/terminate Terminate a job
terminateJob(id){
return busy(client._.put(`/jobs/${id}/terminate`));
},
};
}

0 comments on commit 2bf072a

Please sign in to comment.