Skip to content

Commit

Permalink
updated cancel job to use delete with hostname #633
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Letter committed Oct 7, 2016
1 parent 1c86615 commit 0121cad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/slycat/web/server/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def abspath(path):
dispatcher.connect("post-remote-launch", "/remotes/launch", slycat.web.server.handlers.post_remote_launch, conditions={ "method": ["POST"] })
dispatcher.connect("post-submit-batch", "/remotes/submit-batch", slycat.web.server.handlers.post_submit_batch, conditions={ "method": ["POST"] })
dispatcher.connect("get-checkjob", "/remotes/checkjob/:hostname/:jid", slycat.web.server.handlers.get_checkjob, conditions={ "method": ["GET"] })
dispatcher.connect("post-cancel-job", "/remotes/cancel-job", slycat.web.server.handlers.post_cancel_job, conditions={ "method": ["POST"] })
dispatcher.connect("delete-job", "/remotes/delete-job/:hostname/:jid", slycat.web.server.handlers.delete_job, conditions={ "method": ["DELETE"] })
dispatcher.connect("get-job-output", "/remotes/get-job-output/:hostname/:jid/path{path:.*}", slycat.web.server.handlers.get_job_output, conditions={ "method": ["POST"] })
dispatcher.connect("post-agent-function", "/remotes/run-agent-function", slycat.web.server.handlers.run_agent_function, conditions={ "method": ["POST"] })

Expand Down
7 changes: 2 additions & 5 deletions packages/slycat/web/server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2034,19 +2034,16 @@ def get_checkjob(hostname, jid):
return session.checkjob(jid)


@cherrypy.tools.json_in(on=True)
@cherrypy.tools.json_out(on=True)
def post_cancel_job():
sid = cherrypy.request.json["sid"]
jid = cherrypy.request.json["jid"]
def delete_job(hostname, jid):
sid = get_sid(hostname)
with slycat.web.server.remote.get_session(sid) as session:
return session.cancel_job(jid)


@cherrypy.tools.json_out(on=True)
def get_job_output(hostname, jid, path):
sid = get_sid(hostname)
cherrypy.log.error("get_output"+hostname+jid+"/path/"+path)
with slycat.web.server.remote.get_session(sid) as session:
return session.get_job_output(jid, path)

Expand Down
6 changes: 3 additions & 3 deletions web-server/js/slycat-job-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ define('slycat-job-checker', ['knockout', 'knockout-mapping', 'slycat-server-roo
$('#slycat-job-checker-connect-modal').modal();
});

$('#slycat-job-checker-clear').on('click', function(e) {
$('#slycat-job-checker-clear').on('click', function(e) {
e.preventDefault();
e.stopPropagation();

Expand All @@ -137,8 +137,8 @@ define('slycat-job-checker', ['knockout', 'knockout-mapping', 'slycat-server-roo
e.preventDefault();
e.stopPropagation();

client.post_cancel_job({
sid: vm.remote.sid(),
client.delete_job({
hostname: vm.remote.hostname(),
jid: vm.jid()
});
});
Expand Down
10 changes: 3 additions & 7 deletions web-server/js/slycat-web-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,15 +896,11 @@ define("slycat-web-client", ["slycat-server-root", "jquery", "URI"], function(se
});
};

module.post_cancel_job = function(params) {
module.delete_job = function(params) {
$.ajax({
contentType: 'application/json',
data: JSON.stringify({
sid: params.sid,
jid: params.jid
}),
type: 'POST',
url: server_root + 'remotes/cancel-job',
type: 'DELETE',
url: server_root + 'remotes/delete-job/'+params.hostname+'/'+params.jid,
success: function(result) {
if (params.success)
params.success(result);
Expand Down

0 comments on commit 0121cad

Please sign in to comment.