批处理 API 和工具概述Overview of Batch APIs and tools

使用 Azure Batch 处理并行工作负荷通常是使用批处理 API 之一以编程方式实现的。Processing parallel workloads with Azure Batch is typically done programmatically by using one of the Batch APIs. 客户端应用程序或服务可使用 Batch API 与 Batch 服务通信。Your client application or service can use the Batch APIs to communicate with the Batch service. Batch API 允许用户创建和管理计算节点(虚拟机或云服务)池。With the Batch APIs, you can create and manage pools of compute nodes, either virtual machines or cloud services. 然后即可计划作业和任务,使之在这些节点上运行。You can then schedule jobs and tasks to run on those nodes.

可以为组织高效处理大量工作负荷,或提供服务前端给客户,让他们可以在一个、数百个甚至数千个节点上,按需要或按计划运行作业和任务。You can efficiently process large-scale workloads for your organization, or provide a service front end to your customers so that they can run jobs and tasks--on demand, or on a schedule--on one, hundreds, or even thousands of nodes.

提示

若要深入了解 Batch API 所提供的功能,请参阅 Batch feature overview for developers(面向开发人员的 Batch 功能概述)。When you're ready to dig in to the Batch API for a more in-depth understanding of the features it provides, check out the Batch feature overview for developers.

## Batch 开发的 Azure帐户。开发 Batch 解决方案时,请在 Azure 订阅中使用以下帐户:## Azure accounts for Batch development When you develop Batch solutions, you use the following accounts in your Azure subscription:

  • Batch 帐户 - Azure Batch 资源(包括池、计算节点、作业和任务)与 Azure Batch 帐户相关联。Batch account - Azure Batch resources, including pools, compute nodes, jobs, and tasks, are associated with an Azure Batch account. 当应用程序针对 Batch 服务提出请求时,会使用 Azure Batch 帐户名称、帐户的 URL 以及访问密钥或 Azure Active Directory 令牌对请求进行身份验证。When your application makes a request against the Batch service, it authenticates the request using the Azure Batch account name, the URL of the account, and either an access key or an Azure Active Directory token. 可以通过 Azure 门户或编程方式创建 Batch 帐户You can create a Batch account in the Azure portal, or programmatically.
  • 存储帐户 - Batch 提供的内置支持允许处理 Azure 存储中的文件。Storage account - Batch includes built-in support for working with files in Azure Storage. 几乎每个 Batch 方案都使用 Azure Blob 存储暂存任务所运行的程序及其处理的数据,以及存储任务生成的输出数据。Nearly every Batch scenario uses Azure Blob storage for staging the programs that your tasks run and the data that they process, and for the storage of output data that they generate. 有关 Batch 中的存储帐户选项,请参阅 Batch 功能概述For storage account options in Batch, see the Batch feature overview.

批处理服务 APIBatch service APIs

应用程序和服务可以发出直接 REST API 调用或使用一个或多个下述客户端库,以便运行和管理 Azure Batch 工作负荷。Your applications and services can issue direct REST API calls or use one or more of the following client libraries to run and manage your Azure Batch workloads.

APIAPI API 参考API reference 下载Download 教程Tutorial 代码示例Code samples 更多信息More Info
批处理 RESTBatch REST docs.azure.cndocs.azure.cn 不适用N/A - - 支持的版本Supported Versions
Batch .NETBatch .NET docs.azure.cndocs.azure.cn NuGet NuGet 教程Tutorial GitHubGitHub 发行说明Release Notes
Batch PythonBatch Python docs.azure.cndocs.azure.cn PyPIPyPI 教程Tutorial GitHubGitHub 自述文件Readme
批处理 Node.jsBatch Node.js docs.azure.cndocs.azure.cn npmnpm 教程Tutorial - 自述文件Readme
批处理 JavaBatch Java docs.azure.cndocs.azure.cn MavenMaven - 自述文件Readme 自述文件Readme

批处理管理 API Batch Management APIs

通过用于 Batch 的 Azure Resource Manager API,可以编程方式访问批处理帐户。The Azure Resource Manager APIs for Batch provide programmatic access to Batch accounts. 可以使用这些 API 通过 Microsoft.Batch 提供程序以编程方式管理 Batch 帐户、配额、应用程序包和其他资源。Using these APIs, you can programmatically manage Batch accounts, quotas, application packages, and other resources through the Microsoft.Batch provider.

APIAPI API 参考API reference 下载Download 教程Tutorial 代码示例Code samples
批次管理 RESTBatch Management REST docs.azure.cndocs.azure.cn 不适用N/A - GitHubGitHub
Batch Management .NETBatch Management .NET docs.azure.cndocs.azure.cn NuGet NuGet 教程Tutorial GitHubGitHub
批次管理 PythonBatch Management Python docs.azure.cndocs.azure.cn PyPIPyPI - -
批次管理 Node.jsBatch Management Node.js docs.azure.cndocs.azure.cn npmnpm - -
批次管理 JavaBatch Management Java - MavenMaven - -

批处理命令行工具Batch command-line tools

这些命令行工具提供的功能与批处理服务和批处理管理 API 相同:These command-line tools provide the same functionality as the Batch service and Batch Management APIs:

适合应用程序开发的其他工具Other tools for application development

下面是一些其他的工具,这些工具可能适合生成和调试批处理应用程序和服务:Here are some additional tools that may be helpful for building and debugging your Batch applications and services:

  • Azure 门户:可以在 Azure 门户中创建、监视和删除 Batch 池、作业和任务。Azure portal: You can create, monitor, and delete Batch pools, jobs, and tasks in the Azure portal. 用户运行作业时,可以查看这些资源和其他资源的状态信息,甚至从池中的计算节点下载文件。You can view the status information for these and other resources while you run your jobs, and even download files from the compute nodes in your pools. 例如,在进行故障排除时下载失败任务的 stderr.txtFor example, you can download a failed task's stderr.txt while troubleshooting. 用户还可以下载可用于登录到计算节点的远程桌面 (RDP) 文件。You can also download Remote Desktop (RDP) files that you can use to log in to compute nodes.
  • Azure Batch Explorer:Batch Explorer(以前称为 BatchLabs)是一个功能丰富的免费独立客户端工具,可帮助创建、调试和监视 Azure Batch 应用程序。Azure Batch Explorer: Batch Explorer (formerly called BatchLabs) is a free, rich-featured, standalone client tool to help create, debug, and monitor Azure Batch applications. 下载适用于 Mac、Linux 或 Windows 的安装包Download an installation package for Mac, Linux, or Windows.
  • Azure Batch Shipyard:Batch Shipyard 是一个帮助在 Azure Batch 上预配、执行和监视基于容器的批处理和 HPC 工作负荷的工具。Azure Batch Shipyard: Batch Shipyard is a tool to help provision, execute, and monitor container-based batch processing and HPC workloads on Azure Batch.
  • Azure 存储资源管理器:严格地说,虽然存储资源管理器不算是 Azure Batch 工具,但却是开发和调试 Batch 解决方案时的另一个很有用的工具。Azure Storage Explorer: While not strictly an Azure Batch tool, the Storage Explorer is another valuable tool to have while you are developing and debugging your Batch solutions.

其他资源Additional resources

后续步骤Next steps

  • 对于准备使用 Batch 的任何人,有必要阅读 面向开发人员的 Batch 功能概述了解基本信息。Read the Batch feature overview for developers, essential information for anyone preparing to use Batch. 本文中包含有关 Batch 服务资源(如池、节点、作业和任务)以及生成 Batch 应用程序时可以使用的许多 API 功能的更多详细信息。The article contains more detailed information about Batch service resources like pools, nodes, jobs, and tasks, and the many API features that you can use while building your Batch application.
  • 下载 GitHub 上的代码示例,了解 C# 和 Python 如何与 Batch 交互以计划和处理示例工作负荷。Download the code samples on GitHub to see how both C# and Python can interface with Batch to schedule and process sample workloads.