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

Python gen.CoordAddress类代码示例

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

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



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

示例1: setUp

    def setUp(self):
        self._cfg_manager = ConfigurationManager.ConfigurationManager()
        self._cfg_manager.append_module(configuration_module)

        self.RESERVATION_ID = "my_reservation_id"
        self.RESERVATION_SESS_ID = SessionId.SessionId(self.RESERVATION_ID)
        self.LAB_SESS_ID = "my_lab_sess_id"
        self.ANY_COORD_ADDR = CoordAddress.translate('translator:[email protected]')
        self.LAB_COORD_ADDR = CoordAddress.translate('laboratory:[email protected]')
开发者ID:zstars,项目名称:weblabdeusto,代码行数:9,代码来源:test_server.py


示例2: test_reserve_experiment

    def test_reserve_experiment(self):
        db_sess_id = ValidDatabaseSessionId('student2', "student")
        sess_id, _ = self.ups._reserve_session(db_sess_id)

        exp_id = ExperimentId('this does not experiment','this neither')
        
        with wlcontext(self.ups, session_id = sess_id):
            self.assertRaises(
                coreExc.UnknownExperimentIdError,
                core_api.reserve_experiment, exp_id, "{}", "{}" )

            exp_id = ExperimentId('ud-dummy','Dummy experiments')

            lab_sess_id = SessionId.SessionId("lab_session_id")

            self.lab_mock.reserve_experiment(exp_id, "{}")
            self.mocker.result(lab_sess_id)
            self.mocker.count(0, 1)
            self.lab_mock.resolve_experiment_address(lab_sess_id)
            self.mocker.result(CoordAddress.translate('foo:[email protected]'))
            self.mocker.count(0, 1)
            self.mocker.replay()


            reservation = core_api.reserve_experiment(exp_id, "{}", "{}")

            self.assertTrue( isinstance(reservation,Reservation.Reservation))

            core_api.logout()
开发者ID:Kiolali,项目名称:weblabdeusto,代码行数:29,代码来源:test_server.py


示例3: setUp

    def setUp(self):
        self.coord_address = CoordAddress.translate( "server0:[email protected]" )

        self.cfg_manager = ConfigurationManager.ConfigurationManager()
        self.cfg_manager.append_module(configuration_module)

        self.cfg_manager._set_value(CoordinationConfigurationParser.COORDINATOR_LABORATORY_SERVERS,
                    { 'server:[email protected]' : { 'inst|ud-dummy|Dummy experiments' : '[email protected] boards' } } )
        self.cfg_manager._set_value("core_number", 0)

        self.mocker  = mocker.Mocker()
        self.lab_mock = self.mocker.mock()

        self.locator = FakeLocator(self.lab_mock)

        # Clean the database
        coordinator = coordinator_create(SQLALCHEMY, self.locator, self.cfg_manager)
        coordinator._clean()
        coordinator.stop()

        # External server generation
        self.ups = WrappedUPS(
                self.coord_address,
                self.locator,
                self.cfg_manager
            )

        self.ups._db_manager._delete_all_uses()
开发者ID:Kiolali,项目名称:weblabdeusto,代码行数:28,代码来源:test_server.py


示例4: enqueue_confirmation

 def enqueue_confirmation(self, lab_coordaddress_str, reservation_id, experiment_instance_id, client_initial_data, server_initial_data, resource_type_name):
     # We can stablish a politic such as using
     # thread pools or a queue of threads or something
     # like that... here
     lab_coordaddress = CoordAddress.translate(lab_coordaddress_str)
     self._confirm_handler = self._confirm_experiment(lab_coordaddress, reservation_id, experiment_instance_id, client_initial_data, server_initial_data, resource_type_name)
     self._confirm_handler.join(self._enqueuing_timeout)
开发者ID:labsland,项目名称:weblabdeusto,代码行数:7,代码来源:confirmer.py


示例5: setUp

    def setUp(self):
        self._cfg_manager = ConfigurationManager.ConfigurationManager()
        self._cfg_manager.append_module(configuration_module)

        self.ANY_COORD_ADDR = CoordAddress.translate('myserver:[email protected]')

        self._clean_up_files_stored_dir()
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:7,代码来源:test_session_handler.py


示例6: test_confirm_experiment

    def test_confirm_experiment(self):
        lab_session_id = SessionId.SessionId("samplesession_id")

        mock_laboratory = self.mocker.mock()
        mock_laboratory.reserve_experiment(ExperimentInstanceId('inst1','exp1','cat1'), '"sample initial data"', mocker.ANY)
        self.mocker.result((lab_session_id, None, { 'address' : 'server:[email protected]'}))

        self.mock_locator[coord_addr(self.lab_address)]
        self.mocker.result(mock_laboratory)
        self.mocker.count(min=1,max=None)

        self.mocker.replay()
        status, reservation1_id = self.coordinator.reserve_experiment(ExperimentId('exp1','cat1'), 30, 5, True, 'sample initial data', DEFAULT_REQUEST_INFO, {})
        now = datetime.datetime.fromtimestamp(int(time.time())) # Remove milliseconds as MySQL do
        self.coordinator.confirmer._confirm_handler.join()
        self.assertEquals( None, self.confirmer._confirm_handler.raised_exc )

        status = self.coordinator.get_reservation_status(reservation1_id)
        expected_status =  WSS.LocalReservedStatus(reservation1_id, CoordAddress.translate(self.lab_address), lab_session_id, { 'address' : 'server:[email protected]' }, 30, '{}', now, now, True, 30, 'http://www.weblab.deusto.es/weblab/client/adfas')

        self.assertTrue(hasattr(status, 'timestamp_before'),  "Unexpected status. Expected\n %s\n, but the obtained does not have timestamp_before:\n %s\n" % (expected_status, status))
        self.assertTrue(status.timestamp_before >= now and status.timestamp_before <= now + datetime.timedelta(seconds=10),
                        "Unexpected status due to timestamp_before: %s; expected something like %s" % (status, expected_status))
        self.assertTrue(status.timestamp_after  >= now and status.timestamp_after  <= now + datetime.timedelta(seconds=10),
                        "Unexpected status due to timestamp_after: %s; expected something like %s" % (status, expected_status))

        status.timestamp_before = now
        status.timestamp_after = now
        self.assertEquals( expected_status, status )
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:29,代码来源:test_confirmer.py


示例7: setUp

    def setUp(self):

        self.maxDiff = 2000

        def _find_server(server_type, name):
            return self.ups

        self._find_server_backup = methods._find_server
        methods._find_server     = _find_server

        self.locator = FakeLocator()
        self.cfg_manager = ConfigurationManager.ConfigurationManager()
        self.cfg_manager.append_module(configuration_module)
        self.cfg_manager._set_value(COORDINATOR_LABORATORY_SERVERS, {
            'server:[email protected]' : {
                'inst|ud-dummy|Dummy experiments' : '[email protected]_type'
            }
        })

        # With this one we clean everything before creating the UPS
        self.coordinator = coordinator_create(SQLALCHEMY, self.locator, self.cfg_manager, ConfirmerClass = ConfirmerMock)
        self.coordinator._clean()

        self.coord_address = CoordAddress.translate( "server0:[email protected]" )

        self.ups = UserProcessingServer.UserProcessingServer(
                self.coord_address,
                self.locator,
                self.cfg_manager
            )

        self.ups._coordinator.stop()
        self.ups._coordinator = self.coordinator
        self.coordinator.add_experiment_instance_id("server:[email protected]", ExperimentInstanceId('inst','ud-dummy','Dummy experiments'), Resource("res_type", "res_inst"))
开发者ID:zstars,项目名称:weblabdeusto,代码行数:34,代码来源:test_monitor_methods.py


示例8: setUp

    def setUp(self):
        coord_address = CoordAddress.translate(
                "server0:[email protected]achine0")

        self.cfg_manager = ConfigurationManager.ConfigurationManager()
        self.cfg_manager.append_module(configuration_module)

        self.core_server = UserProcessingServer(coord_address, None, self.cfg_manager)
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:8,代码来源:test_server.py


示例9: test_get_is_up_and_running_handlers

    def test_get_is_up_and_running_handlers(self):
        clients_coord_addresses = CoordAddress.translate("myserver:[email protected]")
        checking_handlers = ('WebcamIsUpAndRunningHandler',)

        self._assigned_micro_servers.add_server( self.exp_inst_id, clients_coord_addresses, { 'checkers' : checking_handlers } )

        retrieved_is_up_and_running_handlers = self._assigned_micro_servers.get_is_up_and_running_handlers(self.exp_inst_id)
        self.assertEquals(checking_handlers, retrieved_is_up_and_running_handlers)
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:8,代码来源:test_assigned_experiments.py


示例10: test_list_experiment_instance_ids

    def test_list_experiment_instance_ids(self):
        clients_coord_addresses = CoordAddress.translate("myserver:[email protected]")
        checking_handlers = ('WebcamIsUpAndRunningHandler',)

        self._assigned_micro_servers.add_server( self.exp_inst_id, clients_coord_addresses, { 'checkers' : checking_handlers } )

        result = self._assigned_micro_servers.list_experiment_instance_ids()
        self.assertEquals([self.exp_inst_id], result)
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:8,代码来源:test_assigned_experiments.py


示例11: test_get_lab_session_id

    def test_get_lab_session_id(self):
        clients_coord_addresses = CoordAddress.translate("myserver:[email protected]")
        checking_handlers = ('WebcamIsUpAndRunningHandler',)

        self._assigned_micro_servers.add_server( self.exp_inst_id, clients_coord_addresses, { 'checkers' : checking_handlers } )

        self._assigned_micro_servers.reserve_experiment(self.exp_inst_id, "foo")
        lab_session_id = self._assigned_micro_servers.get_lab_session_id(self.exp_inst_id)
        self.assertEquals("foo", lab_session_id)
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:9,代码来源:test_assigned_experiments.py


示例12: test_get_coord_address

    def test_get_coord_address(self):
        clients_coord_addresses = CoordAddress.translate("myserver:[email protected]")
        checking_handlers = ("WebcamIsUpAndRunningHandler",)

        self._assigned_micro_servers.add_server(
            self.exp_inst_id, clients_coord_addresses, {"checkers": checking_handlers}
        )

        coord_address = self._assigned_micro_servers.get_coord_address(self.exp_inst_id)
        self.assertEquals(clients_coord_addresses, coord_address)
开发者ID:zstars,项目名称:weblabdeusto,代码行数:10,代码来源:test_assigned_experiments.py


示例13: enqueue_free_experiment

 def enqueue_free_experiment(self, lab_coordaddress_str, reservation_id, lab_session_id, experiment_instance_id):
     # We can stablish a policy such as using
     # thread pools or a queue of threads or something
     # like that... here
     if lab_session_id is None: # If the user didn't manage to obtain a session_id, don't call the free_experiment method
         experiment_response = None
         initial_time = end_time = datetime.datetime.now()
         self.coordinator.confirm_resource_disposal(lab_coordaddress_str, reservation_id, lab_session_id, experiment_instance_id, experiment_response, initial_time, end_time)
     else: # Otherwise...
         lab_coordaddress = CoordAddress.translate(lab_coordaddress_str)
         self._free_handler = self._free_experiment(lab_coordaddress, reservation_id, lab_session_id, experiment_instance_id)
         self._free_handler.join(self._enqueuing_timeout)
开发者ID:labsland,项目名称:weblabdeusto,代码行数:12,代码来源:confirmer.py


示例14: test_add_server

    def test_add_server(self):
        clients_coord_addresses = CoordAddress.translate("myserver:[email protected]")
        checking_handlers = ('WebcamIsUpAndRunningHandler',)

        self._assigned_micro_servers.add_server( self.exp_inst_id, clients_coord_addresses, { 'checkers' : checking_handlers } )

        self.assertRaises(
            LaboratoryErrors.ExperimentAlreadyFoundError,
            self._assigned_micro_servers.add_server,
            self.exp_inst_id,
            clients_coord_addresses,
            { 'checkers' : checking_handlers }
        )
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:13,代码来源:test_assigned_experiments.py


示例15: _reserve_experiment

    def _reserve_experiment(self):
        db_sess_id = ValidDatabaseSessionId('student1', "student")
        sess_id, _ = self.ups._reserve_session(db_sess_id)
        with wlcontext(self.ups, session_id = sess_id):
            exp_id = ExperimentId('ud-dummy','Dummy experiments')

            lab_sess_id = SessionId.SessionId("lab_session_id")
            self.lab_mock.reserve_experiment(exp_id, "{}")
            self.mocker.result(lab_sess_id)
            self.mocker.count(0, 1)
            self.lab_mock.resolve_experiment_address(lab_sess_id)
            self.mocker.result(CoordAddress.translate('foo:[email protected]'))
            self.mocker.count(0, 1)
            self.mocker.replay()

            reservation = core_api.reserve_experiment(exp_id, "{}", "{}")
            return reservation.reservation_id
开发者ID:Kiolali,项目名称:weblabdeusto,代码行数:17,代码来源:test_server.py


示例16: to_business_light

 def to_business_light(self):
     usage = ExperimentUsage()
     usage.experiment_use_id = self.id
     usage.start_date        = _splitted_utc_datetime_to_timestamp(self.start_date, self.start_date_micro)
     usage.end_date          = _splitted_utc_datetime_to_timestamp(self.end_date, self.end_date_micro)
     usage.from_ip           = self.origin
     usage.reservation_id    = self.reservation_id
     usage.experiment_id     = ExperimentId(self.experiment.name, self.experiment.category.name)
     usage.coord_address     = CoordAddress.translate(self.coord_address)
     
     request_info = {}
     for prop in self.properties:
         name  = prop.property_name.name
         value = prop.value
         request_info[name] = value
     
     usage.request_info = request_info
     return usage
开发者ID:Kiolali,项目名称:weblabdeusto,代码行数:18,代码来源:model.py


示例17: check_laboratory

    def check_laboratory(self, address_str, experiments):
        """ Checks in that laboratory address which experiments are broken and which ones are working.

        :param address_str: laboratory address, e.g. "laboratory:[email protected]"
        :param experiments: dictionary of experiments: resources, e.g. { "exp1|ud-fpga|FPGA experiments" : "[email protected] boards"}
        """
        broken_resources = {
            # resource_id : error_message
        }

        try:
            address = CoordAddress.translate(address_str)
            server = self.locator[address]
            failing_experiments = server.check_experiments_resources()
            #
            # failing_experiments is a dictionary such as:
            # {
            #     experiment_instance_id : error_message
            # }
            # 
            for failing_experiment in failing_experiments:
                if not failing_experiment in experiments:
                    log.log( ResourcesChecker, log.level.Error,
                            "Laboratory server %s reported that experiment %s was failing; however this laboratory does NOT manage this experiment. Attack?" % (address_str, failing_experiment))
                    continue

                # 
                # The error for a resource will be concatenated
                # 
                broken_resource = experiments[failing_experiment]
                error_message   = failing_experiments[failing_experiment]
                if broken_resource in broken_resources:
                    broken_resources[broken_resource] = broken_resources[broken_resource] + ';' + error_message
                else:
                    broken_resources[broken_resource] = error_message

        except:
            traceback.print_exc()
            log.log( ResourcesChecker, log.level.Critical,
                    "Error checking resources of laboratory %s " % address_str)
            log.log_exc(ResourcesChecker, log.level.Critical)
        
        return broken_resources
开发者ID:zstars,项目名称:weblabdeusto,代码行数:43,代码来源:checker.py


示例18: test_reserve_experiment

    def test_reserve_experiment(self):
        clients_coord_addresses = CoordAddress.translate("myserver:m[email protected]")
        checking_handlers = ('WebcamIsUpAndRunningHandler',)

        self._assigned_micro_servers.add_server( self.exp_inst_id, clients_coord_addresses, { 'checkers' : checking_handlers } )

        def check_reserve():
            result = self._assigned_micro_servers.reserve_experiment( self.exp_inst_id, "my session id" )

            self.assertEquals( clients_coord_addresses, result )
        check_reserve()
        self._assigned_micro_servers.free_experiment(self.exp_inst_id)
        check_reserve()
        self._assigned_micro_servers.free_experiment(self.exp_inst_id)
        self.assertRaises(
            LaboratoryErrors.AlreadyFreedExperimentError,
            self._assigned_micro_servers.free_experiment,
            self.exp_inst_id
        )
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:19,代码来源:test_assigned_experiments.py


示例19: setUp

    def setUp(self):

        self.coord_address = CoordAddress.translate( "server0:[email protected]")

        self.mock_locator  = self.mocker.mock()

        self.cfg_manager = ConfigurationManager.ConfigurationManager()
        self.cfg_manager.append_module(configuration_module)
        self.cfg_manager._set_value(COORDINATOR_LABORATORY_SERVERS, {
            u'lab1:[email protected]' : {
                'inst1|exp1|cat1' : '[email protected]res_type'
            },
        })

        self.coordinator = coordinator_create(SQLALCHEMY, self.mock_locator, self.cfg_manager)
        self.coordinator._clean()
        self.confirmer   = self.coordinator.confirmer

        self.lab_address = u"lab1:[email protected]"
        self.coordinator.add_experiment_instance_id(self.lab_address, ExperimentInstanceId('inst1', 'exp1','cat1'), Resource("res_type", "res_inst"))
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:20,代码来源:test_confirmer.py


示例20: _confirm_experiment

    def _confirm_experiment(self, lab_coordaddress, reservation_id, experiment_instance_id, client_initial_data, server_initial_data, resource_type_name):
        try:
            initial_time = datetime.datetime.now()
            try:
                labserver = self.locator[lab_coordaddress]
                reservation_result  = labserver.reserve_experiment(experiment_instance_id, client_initial_data, server_initial_data)
                lab_session_id, server_initialization_response, exp_info = reservation_result
            except Exception as e:
                if DEBUG:
                    traceback.print_exc()
                log.log( ReservationConfirmer, log.level.Error, "Exception confirming experiment: %s" % e )
                log.log_exc( ReservationConfirmer, log.level.Warning )

                self.coordinator.mark_experiment_as_broken(experiment_instance_id, [str(e)])
            else:
                end_time = datetime.datetime.now()
                experiment_coordaddress = CoordAddress.translate(exp_info['address'])
                self.coordinator.confirm_experiment(experiment_coordaddress, experiment_instance_id.to_experiment_id(), reservation_id, lab_coordaddress.address, lab_session_id, server_initialization_response, initial_time, end_time, resource_type_name, exp_info)
        except:
            if DEBUG:
                traceback.print_exc()
            log.log(ReservationConfirmer, log.level.Critical, "Unexpected exception confirming experiment")
            log.log_exc(ReservationConfirmer, log.level.Critical)
开发者ID:labsland,项目名称:weblabdeusto,代码行数:23,代码来源:confirmer.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python log.log函数代码示例发布时间:2022-05-26
下一篇:
Python humanize.humanize_error函数代码示例发布时间: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