• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qubole.Qubole类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: terminate

 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,代码行数:7,代码来源:cluster.py


示例2: start

 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,代码行数:7,代码来源:cluster.py


示例3: update

 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,代码行数:7,代码来源:cluster.py


示例4: list

    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,代码行数:35,代码来源:cluster.py


示例5: cancel_id

    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,代码行数:10,代码来源:commands.py


示例6: get_log_id

    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,代码行数:10,代码来源:commands.py


示例7: get_log

    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,代码行数:11,代码来源:commands.py


示例8: save_results_locally

    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,代码行数:50,代码来源:commands.py


示例9: reassign_label

    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,代码行数:15,代码来源:cluster.py


示例10: list

    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,代码行数:15,代码来源:actions.py


示例11: get_results

    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,代码行数:15,代码来源:commands.py


示例12: create

    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,代码行数:16,代码来源:commands.py


示例13: list

    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,代码行数:20,代码来源:cluster.py


示例14: get_results

    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,代码行数:22,代码来源:commands.py


示例15: create

 def create(cls, **kwargs):
     conn=Qubole.agent()
     return cls(conn.post(cls.rest_entity_path, data=kwargs))
开发者ID:PraveenSeluka,项目名称:qds-sdk-py,代码行数:3,代码来源:resource.py


示例16: status

 def status(cls, cluster_id):
     """
     Show the status of the cluster with id `cluster_id`.
     """
     conn = Qubole.agent()
     return conn.get(cls.element_path(cluster_id) + "/state")
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:6,代码来源:cluster.py


示例17: find

    def find(cls, **kwargs):
        if cls.cached_resource is None:
            conn=Qubole.agent()
            cls.cached_resource = cls(conn.get(cls.rest_entity_path))

        return cls.cached_resource
开发者ID:PraveenSeluka,项目名称:qds-sdk-py,代码行数:6,代码来源:resource.py


示例18: rerun

 def rerun(self):
     conn = Qubole.agent()
     return conn.post(self.element_path(self.id) + "/rerun", data=None)
开发者ID:amelio-dx,项目名称:qds-sdk-py,代码行数:3,代码来源:actions.py


示例19: kill

 def kill(self):
     conn = Qubole.agent()
     return conn.put(self.element_path(self.id) + "/kill", data=None)
开发者ID:amelio-dx,项目名称:qds-sdk-py,代码行数:3,代码来源:actions.py


示例20: create

 def create(cls, cluster_info):
     """
     Create a new cluster using information provided in `cluster_info`.
     """
     conn = Qubole.agent()
     return conn.post(cls.rest_entity_path, data=cluster_info)
开发者ID:raghav-ghaiee-komli,项目名称:qds-sdk-py,代码行数:6,代码来源:cluster.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python queen_attack.can_attack函数代码示例发布时间:2022-05-26
下一篇:
Python qubic.QubicAcquisition类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap