This is an automated email from the ASF dual-hosted git repository.

dkuzmenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new f6bd0eb807 HIVE-26525: Update llap-server python scripts to be 
compatible with python 3 (Simhadri Govindappa, reviewed by Denys Kuzmenko)
f6bd0eb807 is described below

commit f6bd0eb80767adfa9ce9f47a6d02a4940903effb
Author: SimhadriGovindappa <[email protected]>
AuthorDate: Wed Sep 14 16:40:36 2022 +0530

    HIVE-26525: Update llap-server python scripts to be compatible with python 
3 (Simhadri Govindappa, reviewed by Denys Kuzmenko)
    
    Closes #3584
---
 llap-server/src/main/resources/package.py | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/llap-server/src/main/resources/package.py 
b/llap-server/src/main/resources/package.py
index 01d78f1fd6..35d3805b97 100644
--- a/llap-server/src/main/resources/package.py
+++ b/llap-server/src/main/resources/package.py
@@ -27,7 +27,7 @@ class LlapResource(object):
                if (not self.direct):
                        h += self.cache
                if size == -1:
-                       print "Cannot determine the container size"
+                       print("Cannot determine the container size")
                        sys.exit(1)
                        return
                else:
@@ -66,7 +66,7 @@ def service_appconfig_global_property(arg):
 def construct_service_site_global_string(kvs):
        if not kvs:
                return ""
-       kvs = map(lambda a : a[0], kvs)
+       kvs = [a[0] for a in kvs]
        return ",\n" + ",\n".join(["    %s:%s" % (json_print(k), json_print(v)) 
for (k,v) in kvs])
 
        
@@ -106,9 +106,9 @@ def main(args):
                sys.exit(0)
                return
        if args.java_child:
-               print "%s Running as a child of LlapServiceDriver" % 
(strftime("%H:%M:%S", gmtime()))
+               print("%s Running as a child of LlapServiceDriver" % 
(strftime("%H:%M:%S", gmtime())))
        else:
-               print "%s Running after LlapServiceDriver" % 
(strftime("%H:%M:%S", gmtime()))
+               print("%s Running after LlapServiceDriver" % 
(strftime("%H:%M:%S", gmtime())))
 
        input = args.input
        output = args.output
@@ -134,7 +134,7 @@ def main(args):
                service_keytab_path = service_keytab
 
        if not input:
-               print "Cannot find input files"
+               print("Cannot find input files")
                sys.exit(1)
                return
        java_home = config["java.home"]
@@ -143,7 +143,9 @@ def main(args):
        resource = LlapResource(config)
 
        daemon_args = args.args
-       if long(max_direct_memory) > 0:
+
+       # https://docs.python.org/3.0/whatsnew/3.0.html#integers
+       if int(max_direct_memory) > 0:
                daemon_args = " -XX:MaxDirectMemorySize=%s %s" % 
(max_direct_memory, daemon_args)
        daemon_args = " -Dhttp.maxConnections=%s %s" % ((max(args.instances, 
resource.executors) + 1), daemon_args)
        vars = {
@@ -182,24 +184,25 @@ def main(args):
        shutil.copytree(src, dst)
 
        # Make the llap tarball
-       print "%s Prepared the files" % (strftime("%H:%M:%S", gmtime()))
+       print("%s Prepared the files" % (strftime("%H:%M:%S", gmtime())))
 
        tarball = tarfile.open(join(output, "%s-%s.tar.gz" % 
(resource.clusterName, version)), "w:gz")
        # recursive add + -C chdir inside
        tarball.add(input, "")
        tarball.close()
 
-       print "%s Packaged the files" % (strftime("%H:%M:%S", gmtime()))
+       print("%s Packaged the files" % (strftime("%H:%M:%S", gmtime())))
 
        with open(join(output, "Yarnfile"), "w") as f:
                f.write(yarnfile % vars)
 
        with open(join(output, "run.sh"), "w") as f:
                f.write(runner % vars)
-       os.chmod(join(output, "run.sh"), 0700)
+       os.chmod(join(output, "run.sh"), 0o700)
+    # https://docs.python.org/3.0/whatsnew/3.0.html#integers
 
        if not args.java_child:
-               print "%s Prepared %s/run.sh for running LLAP on YARN" % 
(strftime("%H:%M:%S", gmtime()), output)
+               print("%s Prepared %s/run.sh for running LLAP on YARN" % 
(strftime("%H:%M:%S", gmtime()), output))
 
 if __name__ == "__main__":
        main(sys.argv[1:])

Reply via email to