Commit 97f62d2e authored by David Anderson's avatar David Anderson Committed by Vitalii Koshura

remote job submission: add set_timeout() to Python API

parent 06ed2cf4
......@@ -19,6 +19,7 @@
# Python bindings of the remote job submission and file management APIs
import urllib
import urllib2
import copy
import xml.etree.ElementTree as ET
import requests
......@@ -111,17 +112,26 @@ class REQUEST:
def __init__(self):
return
timeout = 0
def do_http_post(req, project_url, handler='submit_rpc_handler.php'):
#print req
url = project_url + handler
params = urllib.urlencode({'request': req})
f = urllib.urlopen(url, params)
if timeout>0:
f = urllib2.urlopen(url, params, timeout)
else:
f = urllib2.urlopen(url, params)
reply = f.read()
#print "REPLY:", reply
return ET.fromstring(reply)
########### API FUNCTIONS START HERE ###############
def set_timeout(x):
global timeout
timeout = x
def abort_batch(req):
req_xml = ('<abort_batch>\n'
'<authenticator>%s</authenticator>\n'
......
......@@ -198,4 +198,5 @@ def test_get_job_counts():
#test_query_batch(328)
#test_submit_batch('batch_39')
#test_create_batch('batch_33')
set_timeout(10)
test_create_batch('batch_138')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment