Exemplo n.º 1
0
 def test_list_setup_task_files_for_cluster_when_cluster_doesnt_support_suffix(self):
     with self.assertRaisesRegexp(CLIError, 'List files is not supported for this cluster'):
         cluster = Cluster(
             node_setup=NodeSetup(
                 setup_task=SetupTask(
                     comman_line='true',
                     std_out_err_path_prefix='$AZ_BATCHAI_MOUNT_ROOT/nfs')))
         _list_node_setup_files_for_cluster(TestCli(), cluster, '.', 60)
Exemplo n.º 2
0
 def test_list_setup_task_files_for_cluster_when_output_not_on_mounts_root(self):
     with self.assertRaisesRegexp(CLIError, 'List files is supported only for clusters with startup task'):
         cluster = Cluster(
             node_setup=NodeSetup(
                 setup_task=SetupTask(
                     comman_line='true',
                     std_out_err_path_prefix='/somewhere')))
         _list_node_setup_files_for_cluster(TestCli(), cluster, '.', 60)
Exemplo n.º 3
0
 def test_list_setup_task_files_for_cluster_when_cluster_has_not_mount_volumes(self):
     with self.assertRaisesRegexp(CLIError, 'List files is supported only for clusters with startup task'):
         cluster = Cluster(
             node_setup=NodeSetup(
                 setup_task=SetupTask(
                     comman_line='true',
                     std_out_err_path_prefix='$AZ_BATCHAI_MOUNT_ROOT/nfs')))
         cluster.node_setup.setup_task.std_out_err_path_suffix = 'path/segment'
         _list_node_setup_files_for_cluster(TestCli(), cluster, '.', 60)
Exemplo n.º 4
0
 def test_list_setup_task_files_for_cluster_when_output_on_bfs(self, get_files_from_bfs):
     cluster = Cluster(
         node_setup=NodeSetup(
             setup_task=SetupTask(
                 comman_line='true',
                 std_out_err_path_prefix='$AZ_BATCHAI_MOUNT_ROOT/bfs')))
     cluster.node_setup.setup_task.std_out_err_path_suffix = 'path/segment'
     cluster.node_setup.mount_volumes = MountVolumes(
         azure_blob_file_systems=[
             AzureBlobFileSystemReference(relative_mount_path='bfs')])
     cli_ctx = TestCli()
     _list_node_setup_files_for_cluster(cli_ctx, cluster, '.', 60)
     get_files_from_bfs.assert_called_once_with(
         cli_ctx,
         AzureBlobFileSystemReference(relative_mount_path='bfs'),
         os.path.join('path/segment/', '.'), 60)
Exemplo n.º 5
0
 def test_list_setup_task_files_for_cluster_when_output_not_on_afs_or_bfs(self):
     with self.assertRaisesRegexp(CLIError, 'List files is supported only for clusters with startup task'):
         cluster = Cluster(
             node_setup=NodeSetup(
                 setup_task=SetupTask(
                     comman_line='true',
                     std_out_err_path_prefix='$AZ_BATCHAI_MOUNT_ROOT/nfs')),
             mount_volumes=MountVolumes(
                 azure_file_shares=[
                     AzureFileShareReference(
                         azure_file_url='https://account.file.core.windows.net/share',
                         relative_mount_path='afs'
                     )]
             ))
         cluster.node_setup.setup_task.std_out_err_path_suffix = 'path/segment'
         _list_node_setup_files_for_cluster(TestCli(), cluster, '.', 60)
Exemplo n.º 6
0
 def test_list_setup_task_files_for_cluster_when_no_node_setup(self):
     self.assertEqual(_list_node_setup_files_for_cluster(TestCli(), Cluster(), '.', 60), [])