当前位置: 首页>>代码示例>>Python>>正文


Python Qubole.agent方法代码示例

本文整理汇总了Python中qubole.Qubole.agent方法的典型用法代码示例。如果您正苦于以下问题:Python Qubole.agent方法的具体用法?Python Qubole.agent怎么用?Python Qubole.agent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qubole.Qubole的用法示例。


在下文中一共展示了Qubole.agent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: terminate

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
 def terminate(cls, cluster_id):
     """
     Terminate the cluster with id `cluster_id`.
     """
     conn = Qubole.agent()
     data = {"state": "terminate"}
     return conn.put(cls.element_path(cluster_id) + "/state", data)
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:9,代码来源:cluster.py

示例2: start

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
 def start(cls, cluster_id):
     """
     Start the cluster with id `cluster_id`.
     """
     conn = Qubole.agent()
     data = {"state": "start"}
     return conn.put(cls.element_path(cluster_id) + "/state", data)
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:9,代码来源:cluster.py

示例3: update

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
 def update(cls, cluster_id, cluster_info):
     """
     Update the cluster with id `cluster_id` using information provided in
     `cluster_info`.
     """
     conn = Qubole.agent()
     return conn.put(cls.element_path(cluster_id), data=cluster_info)
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:9,代码来源:cluster.py

示例4: list

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def list(cls, label=None, state=None):
        """
        List existing clusters present in your account.

        Kwargs:
            `label`: list cluster with this label

            `state`: list only those clusters which are in this state

        Returns:
            List of clusters satisfying the given criteria

        Raises:
            Exception if both label and state options are provided
        """
        conn = Qubole.agent()
        if label is None and state is None:
            return conn.get(cls.rest_entity_path)
        elif label is not None and state is None:
            cluster_list = conn.get(cls.rest_entity_path)
            result = []
            for cluster in cluster_list:
                if label in cluster['cluster']['label']:
                    result.append(cluster)
            return result
        elif label is None and state is not None:
            cluster_list = conn.get(cls.rest_entity_path)
            result = []
            for cluster in cluster_list:
                if state.lower() == cluster['cluster']['state'].lower():
                    result.append(cluster)
            return result
        else:
            raise Exception("Can filter either by label or" +
                            " by state but not both")
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:37,代码来源:cluster.py

示例5: cancel_id

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def cancel_id(cls, id):
        """
        Cancels command denoted by this id

        Args:
            `id` - command id
        """
        conn=Qubole.agent()
        data={"status":"kill"}
        conn.put(cls.element_path(id), data)
开发者ID:atanu1991,项目名称:qds-sdk-py,代码行数:12,代码来源:commands.py

示例6: get_log_id

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def get_log_id(cls, id):
        """
        Fetches log for the command represented by this id

        Args:
            `id`: command id
        """
        conn = Qubole.agent()
        r = conn.get_raw(cls.element_path(id) + "/logs")
        return r.text
开发者ID:vogxn,项目名称:qds-sdk-py,代码行数:12,代码来源:commands.py

示例7: get_log

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def get_log(self):
        """
        Fetches log for the command represented by this object

        Returns:
            The log as a string
        """
        log_path = self.meta_data['logs_resource']
        conn=Qubole.agent()
        r=conn.get_raw(log_path)
        return r.text
开发者ID:atanu1991,项目名称:qds-sdk-py,代码行数:13,代码来源:commands.py

示例8: save_results_locally

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def save_results_locally(self, local_file_location, boto_client=None):
        """
        Saves the results to the passed in file_location

        Args:
            local_file_location: the place locally where you want to store the file
            boto_client: the boto client to use if we're fetching results from s3.

        Returns:
            dictionary of:
             'file_location' : <file path + file name>
             'size' : <file size>
             'success' : True or False
             'error' : error message if there was any
        """
        result_path = self.meta_data['results_resource']
        conn=Qubole.agent()
        r = conn.get(result_path)
        if r.get('inline'):
            error = ''
            success = True
            try:
                f = open(local_file_location, 'w')
                f.write(r['results'])
                f.close()
            except Exception as e:
                error = e
                success = False
            result = {
                'file_location': local_file_location,
                'size': os.path.getsize(local_file_location),
                'success': success,
                'error': error
            }
            return result
        else:
            # TODO:finish
            s3_locations = r.get('result_location')
            if not boto_client:
                log.error("Unable to download results, no boto client provided.\
                           Please fetch from S3: %s" % s3_locations)    
                return {'success':False, 'error': 'Not boto client'}
            print s3_locations
            result = {
                'file_location': local_file_location,
                'size': 0, #os.path.getsize(local_file_location),
                'success': False,
                'error': 'Not implemented'
            }
            return result
开发者ID:Nextdoor,项目名称:qds-sdk-py,代码行数:52,代码来源:commands.py

示例9: reassign_label

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def reassign_label(cls, destination_cluster, label):
        """
        Reassign a label from one cluster to another.

        Args:
            `destination_cluster`: id of the cluster to move the label to

            `label`: label to be moved from the source cluster
        """
        conn = Qubole.agent()
        data = {
                    "destination_cluster": destination_cluster,
                    "label": label
                }
        return conn.put(cls.rest_entity_path + "/reassign-label", data)
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:17,代码来源:cluster.py

示例10: list

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def list(page = None, per_page = None):
        conn = Qubole.agent()
        url_path = Action.rest_entity_path
        params = {}
        if page is not None:
            params['page'] = page  
        if per_page is not None:
            params['per_page'] = per_page  

        #Todo Page numbers are thrown away right now
        actjson = conn.get(url_path, params)
        actlist = []
        for a in actjson["actions"]:
            actlist.append(Action(a))
        return actlist
开发者ID:amelio-dx,项目名称:qds-sdk-py,代码行数:17,代码来源:actions.py

示例11: get_results

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def get_results(self):
        """
        Fetches the result for the command represented by this object

        Returns:
            The result as a string
        """
        result_path = self.meta_data['results_resource']
        conn=Qubole.agent()
        r = conn.get(result_path)
        if r.get('inline'):
            return r['results'] 
        else:
            # TODO - this will be implemented in future
            log.error("Unable to download results, please fetch from S3")
开发者ID:atanu1991,项目名称:qds-sdk-py,代码行数:17,代码来源:commands.py

示例12: create

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def create(cls, **kwargs):
        """
        Create a command object by issuing a POST request to the /command endpoint
        Note - this does not wait for the command to complete

        Args:
            `\**kwargs` - keyword arguments specific to command type

        Returns:
            Command object
        """

        conn=Qubole.agent()
        if kwargs.get('command_type') is None:
            kwargs['command_type'] = cls.__name__
        return cls(conn.post(cls.rest_entity_path, data=kwargs))
开发者ID:Nextdoor,项目名称:qds-sdk-py,代码行数:18,代码来源:commands.py

示例13: list

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def list(cls, state=None):
        """
        List existing clusters present in your account.

        Kwargs:
            `state`: list only those clusters which are in this state

        Returns:
            List of clusters satisfying the given criteria
        """
        conn = Qubole.agent()
        if state is None:
            return conn.get(cls.rest_entity_path)
        elif state is not None:
            cluster_list = conn.get(cls.rest_entity_path)
            result = []
            for cluster in cluster_list:
                if state.lower() == cluster['cluster']['state'].lower():
                    result.append(cluster)
            return result
开发者ID:vogxn,项目名称:qds-sdk-py,代码行数:22,代码来源:cluster.py

示例14: get_results

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
    def get_results(self, fp=sys.stdout, inline=True):
        """
        Fetches the result for the command represented by this object

        @param fp: a file object to write the results to directly
        """
        result_path = self.meta_data['results_resource']
        
        conn=Qubole.agent()
        
        r = conn.get(result_path , {'inline': inline})
        if r.get('inline'):
            fp.write(r['results'].encode('utf8'))
        else:    
            acc = Account.find()
            boto_conn = boto.connect_s3(aws_access_key_id=acc.storage_access_key,
                                        aws_secret_access_key=acc.storage_secret_key)

            log.info("Starting download from result locations: [%s]" % ",".join(r['result_location']))

            for s3_path in r['result_location']:
                _download_to_local(boto_conn, s3_path, fp)
开发者ID:PraveenSeluka,项目名称:qds-sdk-py,代码行数:24,代码来源:commands.py

示例15: create

# 需要导入模块: from qubole import Qubole [as 别名]
# 或者: from qubole.Qubole import agent [as 别名]
 def create(cls, **kwargs):
     conn=Qubole.agent()
     return cls(conn.post(cls.rest_entity_path, data=kwargs))
开发者ID:PraveenSeluka,项目名称:qds-sdk-py,代码行数:5,代码来源:resource.py


注:本文中的qubole.Qubole.agent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。