Skip to content
This repository was archived by the owner on Jan 25, 2018. It is now read-only.

Commit 5fc7e55

Browse files
author
Lee Kamentsky
committed
First cut rhel 6 batchprofiler
1 parent d50292d commit 5fc7e55

10 files changed

+1342
-765
lines changed

JobStatus.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env ./batchprofiler.sh
2+
#
3+
# Start a batch operation from a web page
4+
#
5+
# CellProfiler is distributed under the GNU General Public License.
6+
# See the accompanying file LICENSE for details.
7+
#
8+
# Copyright (c) 2003-2009 Massachusetts Institute of Technology
9+
# Copyright (c) 2009-2015 Broad Institute
10+
# All rights reserved.
11+
#
12+
# Please see the AUTHORS file for credits.
13+
#
14+
# Website: http://www.cellprofiler.org
15+
16+
################
17+
#
18+
# REST interface for job status
19+
#
20+
################
21+
22+
import cgitb
23+
cgitb.enable()
24+
import json
25+
import os
26+
import sys
27+
from RunBatch import BPJob
28+
from bpformdata import REQUEST_METHOD, RM_PUT
29+
30+
K_ACTION = "action"
31+
A_CREATE = "create"
32+
A_READ = "read"
33+
A_UPDATE = "update"
34+
A_DELETE = "delete"
35+
36+
K_JOB_ID = "job_id"
37+
K_RUN_ID = "run_id"
38+
K_STATUS = "status"
39+
40+
if REQUEST_METHOD == RM_PUT:
41+
data = json.load(sys.stdin)
42+
action = data[K_ACTION]
43+
job_id = int(data[K_JOB_ID])
44+
run_id = int(data[K_RUN_ID])
45+
job = BPJob(run_id, job_id)
46+
if action == A_CREATE:
47+
job.create()
48+
elif action == A_UPDATE:
49+
status = data[K_STATUS]
50+
job.update_status(status)
51+
else:
52+
raise NotImplementedError("Unsupported action: %s" % action)
53+
else:
54+
raise NotImplementedError("Unsupported http method: %s" % REQUEST_METHOD)
55+

0 commit comments

Comments
 (0)