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


Python gen.CoordAddress类代码示例

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


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


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