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


Python Helpers.wait_for_nodes方法代码示例

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


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

示例1: test_setup_task_execution

# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import wait_for_nodes [as 别名]
    def test_setup_task_execution(self, resource_group, location, storage_account, storage_account_key):
        """Tests setup task execution.
        """
        cluster = Helpers.create_cluster(
            self.client, location, resource_group.name, self.cluster_name, 'STANDARD_D1', 1,
            storage_account.name, storage_account_key,
            setup_task_cmd='echo $GREETING $SECRET_GREETING',
            setup_task_env={'GREETING': 'setup task'},
            setup_task_secrets={'SECRET_GREETING': 'has a secret'})  # type: models.Cluster

        # Verify that the cluster is reported in the list of clusters
        Helpers.assert_existing_clusters_are(self, self.client, resource_group.name, [self.cluster_name])

        # Verify that one node is allocated and become available
        self.assertEqual(
            Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, 1,
                                   Helpers.NODE_STARTUP_TIMEOUT_SEC), 1)

        # Check that server doesn't return values for secrets
        self.assertEqual(len(cluster.node_setup.setup_task.secrets), 1)
        self.assertEqual(cluster.node_setup.setup_task.secrets[0].name, 'SECRET_GREETING')
        self.assertIsNone(cluster.node_setup.setup_task.secrets[0].value)
        # Verify that the setup task is completed by checking generated output. BatchAI reports a path which was auto-
        # generated for storing setup output logs.
        setup_task_output_path = cluster.node_setup.setup_task.std_out_err_path_suffix
        nodes = Helpers.get_node_ids(self.client, resource_group.name, self.cluster_name)
        self.assertEqual(len(nodes), 1)
        node_id = nodes[0]
        Helpers.assert_file_in_file_share(self, storage_account.name, storage_account_key,
                                          setup_task_output_path,
                                          'stdout-{0}.txt'.format(node_id),
                                          u'setup task has a secret\n')
        Helpers.assert_file_in_file_share(self, storage_account.name, storage_account_key,
                                          setup_task_output_path, 'stderr-{0}.txt'.format(node_id), u'')
        self.client.clusters.delete(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name).result()
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:37,代码来源:test_mgmt_batchai_clusters.py

示例2: test_creation_and_deletion

# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import wait_for_nodes [as 别名]
    def test_creation_and_deletion(self, resource_group, location, storage_account, storage_account_key):
        """Tests basic use-case scenario.

        1. Create cluster
        2. Execute a task on the host
        3. Execute a task in a docker container
        4. Delete cluster
        """
        cluster = Helpers.create_cluster(
            self.client, location, resource_group.name, self.cluster_name, 'STANDARD_D1', 1,
            storage_account.name, storage_account_key)

        self.assertEqual(cluster.name, self.cluster_name)
        self.assertIsNone(cluster.errors)
        self.assertEqual(cluster.vm_size, 'STANDARD_D1')

        # Verify that the cluster is reported in the list of clusters
        Helpers.assert_existing_clusters_are(self, self.client, resource_group.name, [self.cluster_name])

        # Verify that one node is allocated and become available
        self.assertEqual(
            Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, 1,
                                   Helpers.NODE_STARTUP_TIMEOUT_SEC), 1)
        Helpers.assert_remote_login_info_reported_for_nodes(self, self.client, resource_group.name,
                                                            self.cluster_name, 1)

        # Verify that the cluster able to run tasks.
        self.assertCanRunJobOnHost(resource_group, location, cluster.id)
        self.assertCanRunJobInContainer(resource_group, location, cluster.id)

        # Test cluster deletion
        self.client.clusters.delete(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name).result()
        Helpers.assert_existing_clusters_are(self, self.client, resource_group.name, [])
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:35,代码来源:test_mgmt_batchai_clusters.py

示例3: assertCanResizeCluster

# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import wait_for_nodes [as 别名]
 def assertCanResizeCluster(self, resource_group, target):
     self.client.clusters.update(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name,
                                 scale_settings=models.ScaleSettings(
                                     manual=models.ManualScaleSettings(target_node_count=target)))
     self.assertEqual(
         Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, target,
                                Helpers.NODE_STARTUP_TIMEOUT_SEC),
         target)
     Helpers.assert_remote_login_info_reported_for_nodes(self, self.client, resource_group.name,
                                                         self.cluster_name, target)
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:12,代码来源:test_mgmt_batchai_clusters.py

示例4: test_cluster_resizing

# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import wait_for_nodes [as 别名]
    def test_cluster_resizing(self, resource_group, location, storage_account, storage_account_key):
        """Tests manual cluster resizing"""
        cluster = Helpers.create_cluster(
            self.client, location, resource_group.name, self.cluster_name, 'STANDARD_D1', 1,
            storage_account.name, storage_account_key)

        # Verify that one node is allocated and become available
        self.assertEqual(
            Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, 1,
                                   Helpers.NODE_STARTUP_TIMEOUT_SEC), 1)
        Helpers.assert_remote_login_info_reported_for_nodes(self, self.client, resource_group.name,
                                                            self.cluster_name, 1)

        self.assertCanResizeCluster(resource_group, 0)
        self.assertCanResizeCluster(resource_group, 1)

        # Verify that cluster able to run tasks after resizing.
        self.assertCanRunJobOnHost(resource_group, location, cluster.id)
        self.client.clusters.delete(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name).result()
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:21,代码来源:test_mgmt_batchai_clusters.py

示例5: test_auto_scaling

# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import wait_for_nodes [as 别名]
    def test_auto_scaling(self, resource_group, location, storage_account, storage_account_key):
        """Tests auto-scaling"""
        # Create the cluster with no nodes.
        cluster = Helpers.create_cluster(
            self.client, location, resource_group.name, self.cluster_name, 'STANDARD_D1', 0,
            storage_account.name, storage_account_key)

        # Switch the cluster into auto-scale mode
        self.client.clusters.update(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name,
                                    scale_settings=models.ScaleSettings(
                                        auto_scale=models.AutoScaleSettings(
                                            minimum_node_count=0,
                                            maximum_node_count=1)))

        # Submit a task. BatchAI must increase the number of nodes to execute the task.
        self.assertCanRunJobOnHost(resource_group, location, cluster.id, timeout_sec=Helpers.AUTO_SCALE_TIMEOUT_SEC)

        # Verify that cluster downsized to zero since there are no more jobs for it
        self.assertEqual(
            Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, 0,
                                   Helpers.NODE_STARTUP_TIMEOUT_SEC), 0)
        self.client.clusters.delete(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name).result()
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:24,代码来源:test_mgmt_batchai_clusters.py


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