Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions data/scripts/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
# specific language governing permissions and limitations
# under the License.
#
from __future__ import print_function
import sys, re
import datetime
import os

table_name=None
if os.environ.has_key('hive_streaming_tablename'):
if 'hive_streaming_tablename' in os.environ:
table_name=os.environ['hive_streaming_tablename']

for line in sys.stdin:
print line
print >> sys.stderr, "dummy"
print(line)
print("dummy", file=sys.stderr)
2 changes: 1 addition & 1 deletion data/scripts/cat_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
import sys

for line in sys.stdin:
print line
print(line)

sys.exit(1)
4 changes: 2 additions & 2 deletions data/scripts/doubleescapedtab.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
import sys

for line in sys.stdin:
print "1\\\\\\t2"
print "1\\\\\\\\t2"
print("1\\\\\\t2")
print("1\\\\\\\\t2")

13 changes: 9 additions & 4 deletions data/scripts/dumpdata_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
#
import sys

for i in xrange(50):
for j in xrange(5):
for k in xrange(20022):
print 20000 * i + k
try:
range
except NameError:
range=xrange

for i in range(50):
for j in range(5):
for k in range(20022):
print(20000 * i + k)

for line in sys.stdin:
pass
2 changes: 1 addition & 1 deletion data/scripts/escapedcarriagereturn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
import sys

for line in sys.stdin:
print "1\\\\r2"
print("1\\\\r2")

2 changes: 1 addition & 1 deletion data/scripts/escapednewline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
import sys

for line in sys.stdin:
print "1\\\\n2"
print("1\\\\n2")

2 changes: 1 addition & 1 deletion data/scripts/escapedtab.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
import sys

for line in sys.stdin:
print "1\\\\t2"
print("1\\\\t2")

4 changes: 2 additions & 2 deletions data/scripts/input20_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import re
dict = {}
for line in sys.stdin.readlines():
if dict.has_key(line):
if line in dict:
x = dict[line]
dict[line] = x + 1
else:
dict[line] = 1
for key in dict:
x = dict[key]
print str(x).strip()+'\t'+re.sub('\t','_',key.strip())
print(str(x).strip()+'\t'+re.sub('\t','_',key.strip()))
6 changes: 3 additions & 3 deletions data/scripts/newline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
import sys

for line in sys.stdin:
print "1\\n2"
print "1\\r2"
print "1\\t2"
print("1\\n2")
print("1\\r2")
print("1\\t2")
10 changes: 5 additions & 5 deletions hcatalog/bin/hcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@


if debug == 1:
print "Would run:"
print "exec " + str(cmd)
print " with HADOOP_CLASSPATH set to %s" % (os.environ['HADOOP_CLASSPATH'])
print("Would run:")
print("exec " + str(cmd))
print(" with HADOOP_CLASSPATH set to %s" % (os.environ['HADOOP_CLASSPATH']))
try:
print " and HADOOP_OPTS set to %s" % (os.environ['HADOOP_OPTS'])
print(" and HADOOP_OPTS set to %s" % (os.environ['HADOOP_OPTS']))
except:
pass
else:
if dumpClasspath == 1:
print os.environ['HADOOP_CLASSPATH']
print(os.environ['HADOOP_CLASSPATH'])
else:
if os.name == "posix":
retval = subprocess.call(cmd)
Expand Down
12 changes: 6 additions & 6 deletions hcatalog/bin/hcat_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

sleepTime = 3
def print_usage():
print "Usage: %s [--config confdir] COMMAND" % (sys.argv[0])
print " start Start HCatalog Server"
print " stop Stop HCatalog Server"
print("Usage: %s [--config confdir] COMMAND" % (sys.argv[0]))
print(" start Start HCatalog Server")
print(" stop Stop HCatalog Server")

def start_hcat():
global sleepTime
Expand Down Expand Up @@ -97,7 +97,7 @@ def start_hcat():
windowsTmpFile = os.path.join(os.environ['HCAT_LOG_DIR'], "windows.tmp")
child = subprocess.Popen([command, "--service", "metastore"], stdout=outfd, stderr=errfd)
pid = child.pid
print "Started metastore server init, testing if initialized correctly..."
print("Started metastore server init, testing if initialized correctly...")
time.sleep(sleepTime)
try:
if os.name == "posix":
Expand All @@ -111,9 +111,9 @@ def start_hcat():
pidFileDesc = open(pidFile, 'w')
pidFileDesc.write(str(pid))
pidFileDesc.close()
print "Metastore initialized successfully"
print("Metastore initialized successfully")
except Exception as inst:
print inst
print(inst)
sys.exit("Metastore startup failed, see %s" % (errFile))

return
Expand Down
5 changes: 5 additions & 0 deletions hcatalog/bin/hcatcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
import os.path
import sys

try:
from functools import reduce
except:
pass

# Find the config file
def findCfgFile():
defaultConfDir = None
Expand Down
2 changes: 1 addition & 1 deletion hcatalog/src/test/e2e/templeton/inpdir/xmlmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@

text = ' '.join( list )
text = text[0:10] + "..." + text[-10:]
print '[[%s]]\t[[%s]]' % (title, text)
print('[[%s]]\t[[%s]]' % (title, text))
2 changes: 1 addition & 1 deletion hcatalog/src/test/e2e/templeton/inpdir/xmlreducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@

line = line.strip()
title, page = line.split('\t', 1)
print '%s\t%s' % ( title, page )
print('%s\t%s' % ( title, page ))
24 changes: 12 additions & 12 deletions service/lib/py/fb303_scripts/fb303_simple_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,35 @@ def service_ctrl(
msg = fb_status_string(status)
if (len(status_details)):
msg += " - %s" % status_details
print msg
print(msg)

if (status == fb_status.ALIVE):
return 2
else:
return 3
except:
print "Failed to get status"
print("Failed to get status")
return 3

# scalar commands
if command in ["version","alive","name"]:
try:
result = fb303_wrapper(command, port, trans_factory, prot_factory)
print result
print(result)
return 0
except:
print "failed to get ",command
print("failed to get " + str(command))
return 3

# counters
if command in ["counters"]:
try:
counters = fb303_wrapper('counters', port, trans_factory, prot_factory)
for counter in counters:
print "%s: %d" % (counter, counters[counter])
print("%s: %d" % (counter, counters[counter]))
return 0
except:
print "failed to get counters"
print("failed to get counters")
return 3


Expand All @@ -95,19 +95,19 @@ def service_ctrl(
fb303_wrapper(command, port, trans_factory, prot_factory)
return 0
except:
print "failed to tell the service to ", command
print("failed to tell the service to " + str(command))
return 3
else:
if command in ["stop","reload"]:
print "root privileges are required to stop or reload the service."
print("root privileges are required to stop or reload the service.")
return 4

print "The following commands are available:"
print("The following commands are available:")
for command in ["counters","name","version","alive","status"]:
print "\t%s" % command
print "The following commands are available for users with root privileges:"
print("\t%s" % command)
print("The following commands are available for users with root privileges:")
for command in ["stop","reload"]:
print "\t%s" % command
print("\t%s" % command)



Expand Down
16 changes: 8 additions & 8 deletions testutils/gen-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ def plot_testsuite_time(json_data, top_k=TOP_K, ascii_graph=False, report_file=N
for k,v in take(d_descending.iteritems(), top_k):
gdata.append((k, v))

print '\nTop ' + str(top_k) + ' testsuite in terms of execution time (in seconds).. [Total time: ' + str(overall_time) + ' seconds]'
print('\nTop ' + str(top_k) + ' testsuite in terms of execution time (in seconds).. [Total time: ' + str(overall_time) + ' seconds]')
if ascii_graph:
graph = Pyasciigraph()
for line in graph.graph('', gdata):
print line
print(line)
else:
for line in gdata:
print line[0] + "\t" + str(line[1])
print(line[0] + "\t" + str(line[1]))

if report_file != None:
with open(report_file, "w") as f:
Expand All @@ -119,7 +119,7 @@ def plot_testcase_time(json_data, top_k=TOP_K, ascii_graph=False, report_file=No
else:
testcase_time[name] = time
if int(suite['testsuite']['@tests']) == 0:
print "Empty batch detected for testsuite: " + suite['testsuite']['@name'] + " which took " + suite['testsuite']['@time'] + "s"
print("Empty batch detected for testsuite: " + suite['testsuite']['@name'] + " which took " + suite['testsuite']['@time'] + "s")

d_descending = OrderedDict(sorted(testcase_time.items(),
key=lambda kv: kv[1], reverse=True))
Expand All @@ -129,14 +129,14 @@ def plot_testcase_time(json_data, top_k=TOP_K, ascii_graph=False, report_file=No
gdata.append((k, v))


print '\nTop ' + str(top_k) + ' testcases in terms of execution time (in seconds).. [Total time: ' + str(overall_time) + ' seconds]'
print('\nTop ' + str(top_k) + ' testcases in terms of execution time (in seconds).. [Total time: ' + str(overall_time) + ' seconds]')
if ascii_graph:
graph = Pyasciigraph()
for line in graph.graph('', gdata):
print line
print(line)
else:
for line in gdata:
print line[0] + "\t" + str(line[1])
print(line[0] + "\t" + str(line[1]))

if report_file != None:
with open(report_file, "a") as f:
Expand Down Expand Up @@ -175,7 +175,7 @@ def print_report(reportUrl, json_dump, top_k, ascii_graph, report_file=None):
links = get_links(reportUrl)
# Create a queue to communicate with the worker threads
q = Queue.Queue()
print "\nProcessing " + str(len(links)) + " test xml reports from " + reportUrl + ".."
print("\nProcessing " + str(len(links)) + " test xml reports from " + reportUrl + "..")
# Create 8 worker threads
for x in range(8):
worker = ReportDownloader(q)
Expand Down