ivandasch commented on a change in pull request #8098:
URL: https://github.com/apache/ignite/pull/8098#discussion_r462762238
##########
File path: modules/ducktests/tests/ignitetest/services/spark.py
##########
@@ -103,28 +109,40 @@ def clean_node(self, node):
node.account.ssh("sudo rm -rf -- %s" %
SparkService.SPARK_PERSISTENT_ROOT, allow_fail=False)
def pids(self, node):
- """Return process ids associated with running processes on the given
node."""
try:
cmd = "jcmd | grep -e %s | awk '{print $1}'" %
self.java_class_name(node)
- pid_arr = [pid for pid in node.account.ssh_capture(cmd,
allow_fail=True, callback=int)]
- return pid_arr
- except (RemoteCommandError, ValueError) as e:
+ return list(node.account.ssh_capture(cmd, allow_fail=True,
callback=int))
+ except (RemoteCommandError, ValueError):
return []
def java_class_name(self, node):
+ """
+ :param node: Spark node.
+ :return: Class name depending on node type (master or slave).
+ """
if node == self.nodes[0]:
return "org.apache.spark.deploy.master.Master"
- else:
- return "org.apache.spark.deploy.worker.Worker"
- def master_log_path(self, node):
+ return "org.apache.spark.deploy.worker.Worker"
+
+ @staticmethod
Review comment:
Despite the fact that in mentioned above codestyle staticmethods are not
welcome in cod, linters generate warnings about unused `self`. And usage of
`@staticmethod` is a preferrable way to mitigate this case. This is so common
in my practice and widely accepted in a python's community.
##########
File path: modules/ducktests/tests/ignitetest/services/spark.py
##########
@@ -103,28 +109,40 @@ def clean_node(self, node):
node.account.ssh("sudo rm -rf -- %s" %
SparkService.SPARK_PERSISTENT_ROOT, allow_fail=False)
def pids(self, node):
- """Return process ids associated with running processes on the given
node."""
try:
cmd = "jcmd | grep -e %s | awk '{print $1}'" %
self.java_class_name(node)
- pid_arr = [pid for pid in node.account.ssh_capture(cmd,
allow_fail=True, callback=int)]
- return pid_arr
- except (RemoteCommandError, ValueError) as e:
+ return list(node.account.ssh_capture(cmd, allow_fail=True,
callback=int))
+ except (RemoteCommandError, ValueError):
return []
def java_class_name(self, node):
+ """
+ :param node: Spark node.
+ :return: Class name depending on node type (master or slave).
+ """
if node == self.nodes[0]:
return "org.apache.spark.deploy.master.Master"
- else:
- return "org.apache.spark.deploy.worker.Worker"
- def master_log_path(self, node):
+ return "org.apache.spark.deploy.worker.Worker"
+
+ @staticmethod
Review comment:
Despite the fact that in mentioned above codestyle staticmethods are not
welcome in code, linters generate warnings about unused `self`. And usage of
`@staticmethod` is a preferrable way to mitigate this case. This is so common
in my practice and widely accepted in a python's community.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]