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

Python snapshot.Snapshot类代码示例

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

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



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

示例1: exportgroup_remove_volumes_by_uri

    def exportgroup_remove_volumes_by_uri(
        self, exportgroup_uri, volumeIdList, sync=False, tenantname=None, projectname=None, snapshots=None, cg=None
    ):
        # if snapshot given then snapshot added to exportgroup
        volume_snapshots = volumeIdList
        if snapshots:
            resuri = None
            if cg:
                blockTypeName = "consistency-groups"
                from consistencygroup import ConsistencyGroup

                cgObject = ConsistencyGroup(self.__ipAddr, self.__port)
                resuri = cgObject.consistencygroup_query(cg, projectname, tenantname)
            else:
                blockTypeName = "volumes"
                if len(volumeIdList) > 0:
                    resuri = volumeIdList[0]
            volume_snapshots = []
            snapshotObject = Snapshot(self.__ipAddr, self.__port)
            for snapshot in snapshots:
                volume_snapshots.append(snapshotObject.snapshot_query("block", blockTypeName, resuri, snapshot))

        parms = {}

        parms["volume_changes"] = self._remove_list(volume_snapshots)
        o = self.send_json_request(exportgroup_uri, parms)
        return self.check_for_sync(o, sync)

        # initator
        """
开发者ID:blueranger,项目名称:coprhd-controller,代码行数:30,代码来源:exportgroup.py


示例2: __init__

 def __init__(self, fpga, comb, f_start, f_stop, logger=logging.getLogger(__name__)):
     """ f_start and f_stop must be in Hz
     """
     self.logger = logger
     snap_name = "snap_{a}x{b}".format(a=comb[0], b=comb[1])
     self.snapshot0 = Snapshot(fpga,
                              "{name}_0".format(name = snap_name),
                              dtype='>i8',
                              cvalue=True,
                              logger=self.logger.getChild("{name}_0".format(name = snap_name)))
     self.snapshot1 = Snapshot(fpga,
                              "{name}_1".format(name = snap_name),
                              dtype='>i8',
                              cvalue=True,
                              logger=self.logger.getChild("{name}_1".format(name = snap_name)))
     self.f_start = np.uint64(f_start)
     self.f_stop = np.uint64(f_stop)
     # this will change from None to an array of phase offsets for each frequency bin 
     # if calibration gets applied at a later stage.
     # this is an array of phases introduced by the system. So if a value is positive, 
     # it means that the system is introducing a phase shift between comb[0] and comb[1]
     # in other words comb1 is artificially delayed. 
     self.calibration_phase_offsets = None
     self.calibration_cable_length_offsets = None
     self.arm()
     self.fetch_signal()
     self.frequency_bins = np.linspace(
         start = self.f_start,
         stop = self.f_stop,
         num = len(self.signal),
         endpoint = False)
开发者ID:jgowans,项目名称:directionFinder_backend,代码行数:31,代码来源:correlation.py


示例3: _get_resource_lun_tuple

    def _get_resource_lun_tuple(self, resources, resType, baseResUri, tenantname, projectname, blockTypeName):
        copyEntries = []
        snapshotObject = Snapshot(self.__ipAddr, self.__port)
        volumeObject = Volume(self.__ipAddr, self.__port)
        for copy in resources:
            copyParam = []
            try:
                copyParam = copy.split(":")
            except Exception as e:
                raise SOSError(
                    SOSError.CMD_LINE_ERR, "Please provide valid format volume: lun for parameter " + resType
                )
            copy = dict()
            if not len(copyParam):
                raise SOSError(SOSError.CMD_LINE_ERR, "Please provide atleast volume for parameter " + resType)
            if resType == "volumes":
                fullvolname = tenantname + "/" + projectname + "/"
                fullvolname += copyParam[0]
                copy["id"] = volumeObject.volume_query(fullvolname)
            if resType == "snapshots":
                copy["id"] = snapshotObject.snapshot_query("block", blockTypeName, baseResUri, copyParam[0])
            if len(copyParam) > 1:
                copy["lun"] = copyParam[1]
            copyEntries.append(copy)
        return copyEntries

        """
开发者ID:blueranger,项目名称:coprhd-controller,代码行数:27,代码来源:exportgroup.py


示例4: make_snapshot

 def make_snapshot(self):
     # self.st = SnapshotThread()
     # self.st.start()
     s = Snapshot()
     commit = s.compare_to(self.snapshots_list[-1])
     self.commits_list.append(commit)
     self.commitsModel.setStringList(self.commitsModel.stringList() + [commit.name])
开发者ID:fevral13,项目名称:registry_vcs,代码行数:7,代码来源:main.py


示例5: _initialize_netcdf

    def _initialize_netcdf(self):
        """
        Initialize the netCDF file for storage.
        
        """

        # Open NetCDF file for writing
        ncfile = netcdf.Dataset(self.fn_storage, "w")  # for netCDF4

        # Store netcdf file handle.
        self.ncfile = ncfile

        # Set global attributes.
        setattr(ncfile, "title", "Multi-State-Transition-Interface-Sampling")
        setattr(ncfile, "application", "Host-Guest-System")
        setattr(ncfile, "program", "run.py")
        setattr(ncfile, "programVersion", __version__)
        setattr(ncfile, "Conventions", "Multi-State Transition Interface TPS")
        setattr(ncfile, "ConventionVersion", "0.1")

        # initialize arrays used for snapshots
        Snapshot._init_netcdf(self)

        # initialize arrays used for trajectories
        Trajectory._init_netcdf(self)

        # Force sync to disk to avoid data loss.
        ncfile.sync()

        return
开发者ID:Asagodi,项目名称:openpathsampling,代码行数:30,代码来源:netcdf_storage.py


示例6: create_snapshot

    def create_snapshot(self, file):

        if not file:
            self.logger.info("Please enter a valid filename.")
            return None

        s = Snapshot(file)
        s.create()
开发者ID:vaizguy,项目名称:snaps,代码行数:8,代码来源:snaps.py


示例7: restore_snapshot

    def restore_snapshot(self, file, version=None):

        if not file:
            self.logger.info("Please enter a valid filename.")
            return None

        s = Snapshot(file)
        s.restore(version)
开发者ID:vaizguy,项目名称:snaps,代码行数:8,代码来源:snaps.py


示例8: onSnapshot

	def onSnapshot(self, evt):
		s = Snapshot(self, self.settings)
		if s.wasSuccessful():
			s.Show()
		else:
			dlg = wx.MessageDialog(self, "Error Taking Picture",
					'Camera Error', wx.OK | wx.ICON_ERROR)
			dlg.ShowModal()
			dlg.Destroy()
开发者ID:jbernardis,项目名称:reprapstat,代码行数:9,代码来源:reprapstat.py


示例9: snapshot

    def snapshot(self, options):
        gp = GitParser()
        sn = Snapshot()

        image_path = sn.snapshot()
        im = ImageManipulator(image_path)
        im.add_text(gp.get_message('-1'), ImageManipulator.POSITION_BOTTOMLEFT,
                self.font_file, self.font_size)
        im.add_text(gp.get_hash('-1')[:10], ImageManipulator.POSITION_TOPRIGHT,
                self.font_file, self.font_size)
        im.save(self._get_snapshot_destination(options.destination))
开发者ID:jeanmonod,项目名称:roflcommits,代码行数:11,代码来源:roflcommits.py


示例10: snapshot

    def snapshot(self, options):
        self._load_repository_settings()
        gp = GitParser()
        sn = Snapshot(int(options.delay), options.device,
                      int(options.skip_frames))

        image_path = sn.snapshot()
        im = ImageManipulator(image_path)
        im.resize(options.image_size)
        im.add_text(gp.get_message('-1'), ImageManipulator.POSITION_BOTTOMLEFT,
                self.font_file, self.font_size)
        im.add_text(gp.get_hash('-1')[:10], ImageManipulator.POSITION_TOPRIGHT,
                self.font_file, self.font_size)
        im.save(self._get_snapshot_destination(options.destination))
开发者ID:sephii,项目名称:roflcommits,代码行数:14,代码来源:app.py


示例11: tabulate_snapshots

    def tabulate_snapshots(self, file):

        if not file:
            self.logger.info("Please enter a valid filename.")
            return None

        s = Snapshot(file)

        table = s.tabulate()

        if table:
            self.logger.info("Snapshot Information for file: {}".format(file))
            self.logger.info(s.tabulate())
        else:
            self.logger.info("No snapshot Information found for file: {}".format(file))
开发者ID:vaizguy,项目名称:snaps,代码行数:15,代码来源:snaps.py


示例12: exportgroup_list

def exportgroup_list(args):
    obj = ExportGroup(args.ip, args.port)
    try:
        uris = obj.exportgroup_list(args.project, args.tenant)
        output = []
        if len(uris) > 0:
            for uri in uris:
                eg = obj.exportgroup_show(uri, args.project, args.tenant)
                # The following code is to get volume/snapshot name part of
                # export group list.
                if eg:
                    if "project" in eg and "name" in eg["project"]:
                        del eg["project"]["name"]
                    volumeuris = common.get_node_value(eg, "volumes")
                    volobj = Volume(args.ip, args.port)
                    snapobj = Snapshot(args.ip, args.port)
                    volnames = []
                    strvol = ""
                    for volumeuri in volumeuris:
                        strvol = str(volumeuri["id"])
                        if strvol.find("urn:storageos:Volume") >= 0:
                            vol = volobj.show_by_uri(strvol)
                            if vol:
                                volnames.append(vol["name"])
                        elif strvol.find("urn:storageos:BlockSnapshot") >= 0:
                            snapshot = snapobj.snapshot_show_uri("block", None, strvol)
                            if snapshot:
                                volnames.append(snapshot["name"])
                    eg["volumes_snapshots"] = volnames
                    output.append(eg)

            if args.verbose:
                return common.format_json_object(output)
            if len(output) > 0:
                if args.long:
                    from common import TableGenerator

                    TableGenerator(
                        output, ["module/name", "volumes_snapshots", "initiator_node", "initiator_port", "tags"]
                    ).printTable()

                else:
                    from common import TableGenerator

                    TableGenerator(output, ["module/name"]).printTable()

    except SOSError as e:
        raise common.format_err_msg_and_raise("list", "exportgroup", e.err_text, e.err_code)
开发者ID:blueranger,项目名称:coprhd-controller,代码行数:48,代码来源:exportgroup.py


示例13: get_web_dir

    def get_web_dir(my, snapshot=None):
        """go through the stored snapshot_code to get the actual path"""
        code = my.get_value("snapshot_code")
        from snapshot import Snapshot

        snapshot = Snapshot.get_by_code(code)
        return snapshot.get_web_dir()
开发者ID:raidios,项目名称:TACTIC,代码行数:7,代码来源:file.py


示例14: _test_naming_util

    def _test_naming_util(my):
       
        #my.clear_naming()
        naming_util = NamingUtil()
        # these should evaluate to be the same
        file_naming_expr1 = ['{$PROJECT}__{context[0]}__hi_{$BASEFILE}.{$EXT}','{project.code}__{context[0]}__hi_{basefile}.{ext}']
        dir_naming_expr2 = ['{$PROJECT}/{context[1]}/somedir/{@GET(.name_first)}','{project.code}/{snapshot.context[1]}/somedir/{sobject.name_first}']

        process= 'light'
        context = 'light/special'
        type = 'ma'
        version = 2

        virtual_snapshot = Snapshot.create_new()
        virtual_snapshot_xml = '<snapshot process=\'%s\'><file type=\'%s\'/></snapshot>' % (process, type)
        virtual_snapshot.set_value("snapshot", virtual_snapshot_xml)
        virtual_snapshot.set_value("process", process)
        virtual_snapshot.set_value("context", context)
        virtual_snapshot.set_value("snapshot_type", 'file')

        virtual_snapshot.set_sobject(my.person)
        virtual_snapshot.set_value("version", version)

        file_name = "abc.txt"
        file_obj = File(File.SEARCH_TYPE)
        file_obj.set_value("file_name", file_name)
        
        for naming_expr in file_naming_expr1:
            file_name = naming_util.naming_to_file(naming_expr, my.person, virtual_snapshot, file=file_obj, file_type="main")
            my.assertEquals(file_name,'unittest__light__hi_abc.txt')

        for naming_expr in dir_naming_expr2:
            dir_name = naming_util.naming_to_dir(naming_expr, my.person, virtual_snapshot, file=file_obj, file_type="main")
            my.assertEquals(dir_name,'unittest/special/somedir/Philip')
开发者ID:0-T-0,项目名称:TACTIC,代码行数:34,代码来源:naming_test.py


示例15: snapshot_from_pdb

def snapshot_from_pdb(pdb_file, simple_topology=False):
    """
    Construct a Snapshot from the first frame in a pdb file without velocities

    Parameters
    ----------
    pdb_file : str
        The filename of the .pdb file to be used
    simple_topology : bool
        if `True` only a simple topology with n_atoms will be created.
        This cannot be used with complex CVs but loads and stores very fast

    Returns
    -------
    :class:`openpathsampling.engines.Snapshot`
        the constructed Snapshot

    """
    pdb = md.load(pdb_file)
    velocities = np.zeros(pdb.xyz[0].shape)

    if simple_topology:
        topology = Topology(*pdb.xyz[0].shape)
    else:
        topology = MDTrajTopology(pdb.topology)

    snapshot = Snapshot.construct(
        coordinates=u.Quantity(pdb.xyz[0], u.nanometers),
        box_vectors=u.Quantity(pdb.unitcell_vectors[0], u.nanometers),
        velocities=u.Quantity(velocities, u.nanometers / u.picoseconds),
        engine=FileEngine(topology, pdb_file)
    )

    return snapshot
开发者ID:,项目名称:,代码行数:34,代码来源:


示例16: get_parent_dir

    def get_parent_dir(my, search_type=None, context=None, sobject=None):
        from project import Project

        if not sobject:
            sobject = my.sobject
        if search_type:
            parent = sobject.get_parent(search_type)
        else:
            search_type = sobject.get_value("search_type")
            search_id = sobject.get_value("search_id")
            parent = Search.get_by_id(search_type, search_id)

        if not parent:
            raise TacticException("No parent exists for '%s', possibly a result of Shot rename or removal." % sobject.get_code())

        # just use the latest of the context desired
        if context:
            search_id = parent.get_id()
            search_type = parent.get_search_type()
            snapshot = Snapshot.get_latest(search_type, search_id, context)
        else:
            # basically this means that without a parent context, there is
            # no way to know the directory this is in.
            snapshot = None
        dirs = Project._get_dir( my.protocol,parent,snapshot,None )
        dirs = dirs.split("/")
        return dirs
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:27,代码来源:dir_naming.py


示例17: _restore_netcdf

    def _restore_netcdf(self):
        """
        Restore the storage from the netCDF file
        """
        # Open NetCDF file for appending
        ncfile = netcdf.Dataset(self.fn_storage, "a")

        # Store netcdf file handle.
        self.ncfile = ncfile

        # initialize arrays used for snapshots
        Snapshot._restore_netcdf(self)

        # initialize arrays used for trajectories
        Trajectory._restore_netcdf(self)

        return
开发者ID:Asagodi,项目名称:openpathsampling,代码行数:17,代码来源:netcdf_storage.py


示例18: run

def run():
    log.info('start')
    print 'Start serving idxd...'
    idx = PfrIndex(config.IDX_FILENAME)
    snapshot_manager = Snapshot()
    if not idx.validate() and \
            not snapshot_manager.restore(PfrIndex) and \
            not idx.create():
        print "Please, close all connections to DB and try again."
        return -1

    Events = namedtuple("Events", "stop endupdate")
    events = Events(Event(), Event())
    __serve_forever( \
            __start_search_daemon(config.IDX_WEBSERVER_PORT, events), \
            __start_update_daemon((config.KANSO_FILENAME, config.KANSO_FILENAME2), events), \
            events)
开发者ID:kats,项目名称:idx,代码行数:17,代码来源:idxd.py


示例19: exportgroup_list

def exportgroup_list(args):
    obj = ExportGroup(args.ip, args.port)
    try:
        uris = obj.exportgroup_list(args.project, args.tenant)
        output = []
        if(len(uris) > 0):
            for uri in uris:
                eg = obj.exportgroup_show(uri, args.project, args.tenant)
                # The following code is to get volume/snapshot name part of export group list.
                if(eg):
                    if("project" in eg and "name" in eg["project"]):
                        del eg["project"]["name"]
                    volumeuris = common.get_node_value(eg, "volumes")
                    volobj = Volume(args.ip, args.port)
                    snapobj = Snapshot(args.ip, args.port)
                    volnames = []
                    strvol = ""
                    for volumeuri in volumeuris:
                        strvol = str(volumeuri['id'])
                        if(strvol.find('urn:storageos:Volume') >= 0):
                            vol = volobj.show_by_uri(strvol)
                            if(vol):
                                volnames.append(vol['name'])
                        elif(strvol.find('urn:storageos:BlockSnapshot')>= 0):
                            snapshot = snapobj.snapshot_show_uri('block', None, strvol)
                            if(snapshot):
                                volnames.append(snapshot['name'])
                    eg['volumes_snapshots']=volnames
                    output.append(eg)
            
	    if(args.verbose == True):
                return common.format_json_object(output)
            if(len(output) > 0):
                if(args.long == True):
                    from common import TableGenerator
                    TableGenerator(output, ['name', 'volumes_snapshots','initiator_node', 'initiator_port']).printTable()

                else:
                    from common import TableGenerator
                    TableGenerator(output, ['name']).printTable()

    except SOSError as e:
        raise common.format_err_msg_and_raise("list", "exportgroup", e.err_text, e.err_code)
开发者ID:tylerbaker,项目名称:controller-openstack-cinder,代码行数:43,代码来源:exportgroup.py


示例20: __init__

    def __init__(self):
        self._benchmark = None
        self._benchmark_history = None
        self._benchmark_return = None
        self._portfolio_history = None
        self._portfolio_return = None
        self._trading_days = None

        self._positions = Positions()
        self._auto_fill_positions()
        self._load_benchmark()
        if not os.path.isfile(HISTORY_IMG_FILE):
            self._draw_history_timeline()

        self._snapshot = Snapshot(self._benchmark, self._positions.get_current_position())
开发者ID:EdwardBetts,项目名称:PortfolioMonitor,代码行数:15,代码来源:terminal.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.timestamp函数代码示例发布时间:2022-05-27
下一篇:
Python snappy.uncompress函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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