You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@airavata.apache.org by "AYPfzU92g7M4aH39-ODVPzqxll48V (via GitHub)" <gi...@apache.org> on 2023/06/24 03:13:03 UTC

[GitHub] [airavata-mft] AYPfzU92g7M4aH39-ODVPzqxll48V opened a new pull request, #105: Java runtime issue 96

AYPfzU92g7M4aH39-ODVPzqxll48V opened a new pull request, #105:
URL: https://github.com/apache/airavata-mft/pull/105

   I wrote a method "check_java_version_method" to handle issue 96. This method checks whether Java is installed or not as well as check whether the Java version is 11 or higher. <br />
   It addresses the issue: https://github.com/apache/airavata-mft/issues/96


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airavata-mft] DImuthuUpe commented on a diff in pull request #105: Java runtime issue 96

Posted by "DImuthuUpe (via GitHub)" <gi...@apache.org>.
DImuthuUpe commented on code in PR #105:
URL: https://github.com/apache/airavata-mft/pull/105#discussion_r1240593238


##########
python-cli/mft_cli/airavata_mft_cli/bootstrap.py:
##########
@@ -62,15 +64,51 @@ def stop_service(bin_path, daemon_script_name):
   finally:
     os.chdir(current_dir)
 
+
+def check_java_version_method(required_version):

Review Comment:
   Change the signature to validate_java_vailability



##########
python-cli/mft_cli/airavata_mft_cli/bootstrap.py:
##########
@@ -62,15 +64,51 @@ def stop_service(bin_path, daemon_script_name):
   finally:
     os.chdir(current_dir)
 
+
+def check_java_version_method(required_version):
+  """
+      Issue 96: https://github.com/apache/airavata-mft/issues/96
+
+      References:
+      ---------
+      https://stackoverflow.com/questions/31807882/get-java-version-number-from-python
+      https://stackoverflow.com/questions/1332598/how-to-determine-whether-java-is-installed-on-a-system-through-python
+  """
+  if shutil.which("java"):
+    res = check_output(['java', '-version'], stderr=STDOUT).decode('utf-8')
+    system_version = ''
+    count = 0
+    for c in res:
+      if c == '"' or count == 1:
+        if (c == '.' or c == '"') and count == 1:
+          break
+        if count == 0:
+          count += 1
+          continue
+        system_version += c
+
+    system_version = int(system_version)
+    if system_version < required_version:
+      print("Airavata MFT requires Java version 11 or higher")

Review Comment:
   "Airavata MFT requires Java version " + required_version + " or higher"



##########
python-cli/mft_cli/airavata_mft_cli/bootstrap.py:
##########
@@ -62,15 +64,51 @@ def stop_service(bin_path, daemon_script_name):
   finally:
     os.chdir(current_dir)
 
+
+def check_java_version_method(required_version):
+  """
+      Issue 96: https://github.com/apache/airavata-mft/issues/96
+
+      References:
+      ---------
+      https://stackoverflow.com/questions/31807882/get-java-version-number-from-python
+      https://stackoverflow.com/questions/1332598/how-to-determine-whether-java-is-installed-on-a-system-through-python
+  """
+  if shutil.which("java"):
+    res = check_output(['java', '-version'], stderr=STDOUT).decode('utf-8')

Review Comment:
   It is initially unclear what the following for loop does to fetch the java version. I think it is better to add an example output for "res" in a comment. Something like "#openjdk version "18.0.2" 2022-07-19"



##########
python-cli/mft_cli/airavata_mft_cli/bootstrap.py:
##########
@@ -62,15 +64,51 @@ def stop_service(bin_path, daemon_script_name):
   finally:
     os.chdir(current_dir)
 
+
+def check_java_version_method(required_version):
+  """
+      Issue 96: https://github.com/apache/airavata-mft/issues/96
+
+      References:
+      ---------
+      https://stackoverflow.com/questions/31807882/get-java-version-number-from-python
+      https://stackoverflow.com/questions/1332598/how-to-determine-whether-java-is-installed-on-a-system-through-python
+  """
+  if shutil.which("java"):
+    res = check_output(['java', '-version'], stderr=STDOUT).decode('utf-8')
+    system_version = ''
+    count = 0
+    for c in res:
+      if c == '"' or count == 1:
+        if (c == '.' or c == '"') and count == 1:
+          break
+        if count == 0:
+          count += 1
+          continue
+        system_version += c
+
+    system_version = int(system_version)
+    if system_version < required_version:
+      print("Airavata MFT requires Java version 11 or higher")
+      print("If you have more than one version of java please set java version 11 or higher to the path")

Review Comment:
   Same as above



##########
python-cli/mft_cli/airavata_mft_cli/bootstrap.py:
##########
@@ -62,15 +64,51 @@ def stop_service(bin_path, daemon_script_name):
   finally:
     os.chdir(current_dir)
 
+
+def check_java_version_method(required_version):
+  """
+      Issue 96: https://github.com/apache/airavata-mft/issues/96
+
+      References:
+      ---------
+      https://stackoverflow.com/questions/31807882/get-java-version-number-from-python
+      https://stackoverflow.com/questions/1332598/how-to-determine-whether-java-is-installed-on-a-system-through-python
+  """
+  if shutil.which("java"):
+    res = check_output(['java', '-version'], stderr=STDOUT).decode('utf-8')
+    system_version = ''

Review Comment:
   rename to java_version



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airavata-mft] DImuthuUpe merged pull request #105: Java runtime issue 96

Posted by "DImuthuUpe (via GitHub)" <gi...@apache.org>.
DImuthuUpe merged PR #105:
URL: https://github.com/apache/airavata-mft/pull/105


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org