HyukjinKwon commented on a change in pull request #30985:
URL: https://github.com/apache/spark/pull/30985#discussion_r559176198



##########
File path: python/pyspark/worker.py
##########
@@ -500,7 +501,12 @@ def main(infile, outfile):
 
             except (resource.error, OSError, ValueError) as e:
                 # not all systems support resource limits, so warn instead of 
failing
-                print("WARN: Failed to set memory limit: {0}\n".format(e), 
file=sys.stderr)
+                print(warnings.formatwarning(
+                    "Failed to set memory limit: {0}\n".format(e),
+                    ResourceWarning,
+                    __file__,
+                    getframeinfo(currentframe()).lineno

Review comment:
       Ah, gotya. To be extremely conservative for the Python implementation 
concern, we could do something like:
   
   ```python
   cur = currentframe()
   getframeinfo(cur).lineno if cut is not None else -1  # or 0 ..?
   ```

##########
File path: python/pyspark/worker.py
##########
@@ -500,7 +501,12 @@ def main(infile, outfile):
 
             except (resource.error, OSError, ValueError) as e:
                 # not all systems support resource limits, so warn instead of 
failing
-                print("WARN: Failed to set memory limit: {0}\n".format(e), 
file=sys.stderr)
+                print(warnings.formatwarning(
+                    "Failed to set memory limit: {0}\n".format(e),

Review comment:
       nit: I think we can remove `\n`.




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to