Repository: DataBiosphere/toil

Issue:
std_dev, mean, movable from cgcluster to bd2k?
Hello,
I was hoping to get around installing cgcluster but apparently this is needed for some core functionality of toil. Would it be feasible to move it to bd2k-python-lib? This is what it looks like for me:
```
$ toil -h
Traceback (most recent call last):
  File "/usr/bin/toil", line 11, in <module>
    load_entry_point('toil==3.5.0a1.dev319', 'console_scripts', 'toil')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/toil/utils/__init__.py", line 6, in <module>
    from toil.provisioners.aws import getCurrentAWSZone
  File "/usr/lib/python2.7/dist-packages/toil/provisioners/aws/__init__.py", line 19, in <module>
    from cgcloud.lib.util import std_dev, mean
ImportError: No module named cgcloud.lib.util
```
Many thanks
Steffen
std_dev, mean, movable from cgcluster to bd2k?
Hello,
I was hoping to get around installing cgcluster but apparently this is needed for some core functionality of toil. Would it be feasible to move it to bd2k-python-lib? This is what it looks like for me:
```
$ toil -h
Traceback (most recent call last):
  File "/usr/bin/toil", line 11, in <module>
    load_entry_point('toil==3.5.0a1.dev319', 'console_scripts', 'toil')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/toil/utils/__init__.py", line 6, in <module>
    from toil.provisioners.aws import getCurrentAWSZone
  File "/usr/lib/python2.7/dist-packages/toil/provisioners/aws/__init__.py", line 19, in <module>
    from cgcloud.lib.util import std_dev, mean
ImportError: No module named cgcloud.lib.util
```
Many thanks
Steffen


Discussion:

Resolving patch:
diff --git a/src/toil/utils/__init__.py b/src/toil/utils/__init__.py
--- a/src/toil/utils/__init__.py
+++ b/src/toil/utils/__init__.py
@@ -3,8 +3,6 @@
 from toil import version
 import logging
 
-from toil.provisioners.aws import getCurrentAWSZone
-
 logger = logging.getLogger(__name__)
 
 
@@ -13,7 +11,11 @@ def addBasicProvisionerOptions(parser):
     parser.add_argument('-p', "--provisioner", dest='provisioner', choices=['aws'], required=False, default="aws",
                         help="The provisioner for cluster auto-scaling. Only aws is currently "
                              "supported")
-    currentZone = getCurrentAWSZone()
+    try:
+        from toil.provisioners.aws import getCurrentAWSZone
+        currentZone = getCurrentAWSZone()
+    except ImportError:
+        currentZone = None
     zoneString = currentZone if currentZone else 'No zone could be determined'
     parser.add_argument('-z', '--zone', dest='zone', required=False, default=currentZone,
                         help="The AWS availability zone of the master. This parameter can also be "


Test patch: