Beispiel #1
0
 def _get_usable_clusters(self, api, min_size=0):
     return [cluster for cluster in clusters.get_clusters(api)['clusters'] \
         if (    (cluster.get('status_code') == clusters.CLUSTER_STATUS_RUNNING)
             and (cluster.get('cluster_type_code') != clusters.CLUSTER_TYPE_SINGLE_JOB)
             and (int(cluster.get('size')) >= min_size)
             and (    len(cluster.get('running_jobs')) == 0
                   or self.share_running_cluster)
            )]
Beispiel #2
0
 def _get_usable_clusters(self, api, min_size=0):
     return [cluster for cluster in clusters.get_clusters(api)['clusters'] \
         if (    (cluster.get('status_code') == clusters.CLUSTER_STATUS_RUNNING)
             and (cluster.get('cluster_type_code') != clusters.CLUSTER_TYPE_SINGLE_JOB)
             and (int(cluster.get('size')) >= min_size)
             and (    len(cluster.get('running_jobs')) == 0
                   or self.share_running_cluster)
            )]
Beispiel #3
0
 def _get_running_idle_clusters(self, api):
     return [
         c for c in clusters.get_clusters(api).get('clusters')
         if not c.get('running_jobs')
         and c.get('status_code') == clusters.CLUSTER_STATUS_RUNNING
     ]
 def test_get_clusters(self):
     response = [{'cluster_id': 'abc'},
                 {'cluster_id': 'xyz'}]
     self.api_mock.get.return_value = response
     return_clusters = clusters.get_clusters(self.api_mock)
     self.assertEquals(return_clusters, response)
Beispiel #5
0
 def _get_running_idle_clusters(self, api):
     return [c for c in clusters.get_clusters(api).get('clusters') if not c.get('running_jobs')
         and c.get('status_code') == clusters.CLUSTER_STATUS_RUNNING]