Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2743#discussion_r19051269
  
    --- Diff: python/pyspark/conf.py ---
    @@ -57,6 +57,22 @@
     __all__ = ['SparkConf']
     
     
    +def _parse_memory(s):
    +    """
    +    Parse a memory string in the format supported by Java (e.g. 1g, 200m) 
and
    +    return the value in MB
    +
    +    >>> _parse_memory("256m")
    +    256
    +    >>> _parse_memory("2g")
    +    2048
    +    """
    +    units = {'g': 1024, 'm': 1, 't': 1 << 20, 'k': 1.0 / 1024}
    +    if s[-1] not in units:
    +        raise ValueError("invalid format: " + s)
    +    return int(float(s[:-1]) * units[s[-1].lower()])
    +
    +
    --- End diff --
    
    This is used by two modules, and related to conf, so it's better to put in 
pyspark.conf.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to