jobs = dict()
c = pycurl.Curl()
-c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
-c.setopt(pycurl.USERPWD, ":")
def get_rest(base_url, url):
+ if debug >= 3:
+ print '# %s%s' % (base_url, url)
+
b = BytesIO()
- c.setopt(pycurl.URL, base_url + url)
+ c.setopt(pycurl.URL, str(base_url + url))
#c.setopt(pycurl.WRITEDATA, b)
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.perform()
j = json.loads(s)
- if debug >= 3:
- print '# %s%s' % (base_url, url)
if debug >= 4:
print json.dumps(j, indent=4)
elif cfg[0] == 'yarn':
base_yarn_url = cfg[1]
elif cfg[0] == 'ssl':
- ssl = cfg[1]
+ ssl = int(cfg[1])
elif opt in ('-d', '--debug'):
debug = int(arg)
elif opt in ('--db'):
print 'Args error'
sys.exit(2)
+if ssl:
+ c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
+ c.setopt(pycurl.USERPWD, ":")
+
base_yarn_url = gen_url(base_yarn_url, 8088, 8090)
base_mapred_url = gen_url(base_mapred_url, 19888, 19890)
print ' elapsed: %.3f s' % ((job.mapred['finishTime'] - job.mapred['startTime']) / 1000.0)
print ' finished: %.3f s' % ((job.mapred['finishTime'] - job.mapred['submitTime']) / 1000.0)
- if job.yarn and debug >= 1:
+ if job.yarn and 'memorySeconds' in job.yarn.keys() and debug >= 1:
print ' MB x s: %d' % job.yarn['memorySeconds']
print ' CPU x s: %d' % job.yarn['vcoreSeconds']
st.execute("UPDATE jobs SET submit=%s, map=%s, reduce=%s WHERE id=%s", (job.mapred['submitTime'], job.mapred['mapsTotal'], job.mapred['reducesTotal'], id))
if debug >= 3: print '[db] job %s mapred updated' % id
changed = 1
- if job.yarn:
+ if job.yarn and 'memorySeconds' in job.yarn.keys():
if data and data[MEMORY] == job.yarn['memorySeconds'] and data[CPU] == job.yarn['vcoreSeconds']:
if debug >= 3: print '[db] job %s yarn is actual' % id
else: