odps-resource
Manage resources in MaxCompute (ODPS)
TLDR
Show resources in the current project
Add file resource
Add archive resource
Add .jar resource
Add .py resource
Delete resource
SYNOPSIS
resource {list | add | drop | get} [arguments] [options]
Examples:
resource list [-p project_name] [-t type]
resource add resource_name local_path [-p project_name] [-f] [-t type]
resource drop resource_name [-p project_name]
resource get resource_name [local_path] [-p project_name]
PARAMETERS
list | ls
Lists all resources or resources of a specific type within a MaxCompute project. Alias ls is also available.
add
Uploads a local file as a resource to the MaxCompute project.
drop
Deletes an existing resource from the MaxCompute project.
get
Downloads a specified resource from the MaxCompute project to a local path.
resource_name
The name assigned to the resource within the MaxCompute project. Used for identifying, adding, dropping, or getting resources.
local_path
The local file system path for the source file to upload (with add) or the destination path for the downloaded file (with get).
-p project_name
Specifies the target MaxCompute project. If omitted, the currently configured default project is used.
-t type
Filters or specifies the type of resource. Valid types include file, jar, and archive. Used with list and add.
-f
Forces an overwrite if a resource with the same name already exists during an add operation.
DESCRIPTION
The odps-resource command is a crucial subcommand within the odpscmd client tool for Alibaba Cloud MaxCompute. It facilitates the management of project-level resources, which include generic files, Java Archive (JAR) packages, and compressed archives. These resources are fundamental for executing custom logic such as User-Defined Functions (UDFs), User-Defined Aggregate Functions (UDAFs), and other custom processes within the MaxCompute environment. The command supports various operations including listing existing resources, adding new ones from local files, deleting resources, and downloading resources from MaxCompute to a local machine. It ensures that all necessary external files for computations are readily available within the MaxCompute distributed system.
CAVEATS
The odps-resource command is not a standalone Linux executable. It is a subcommand of the odpscmd client, which must be installed and configured with appropriate access credentials for Alibaba Cloud MaxCompute. Users require specific MaxCompute project permissions (e.g., CreateResource, DeleteResource, ListResource, DownloadResource) to perform operations. Resource names must be unique within a project. There might be size limitations for individual resources depending on MaxCompute service limits.
RESOURCE TYPES EXPLAINED
MaxCompute distinguishes between three main resource types:
file: General purpose files, often used for data or configuration.
jar: Java Archive files, specifically designed for Java UDFs and UDAFs.
archive: Compressed archives (e.g., .zip, .tar.gz) that can contain multiple files, useful for Python UDFs or other complex dependencies.
The type influences how MaxCompute processes and makes the resource available to your jobs.
USAGE CONTEXT
This command is typically executed in two ways:
1. Within the interactive odpscmd shell: After launching odpscmd, you can directly type resource add ...
.
2. Non-interactively via the odpscmd -e option: For scripting purposes, you can run odpscmd -e "resource add ..."
from your Linux terminal.
HISTORY
MaxCompute, formerly known as ODPS, is Alibaba Cloud's fully managed, serverless data warehousing solution. The odpscmd client and its various subcommands, including resource, have been developed as essential tools for interacting with the MaxCompute platform. The resource command's evolution parallels the growing need for robust management of external dependencies like UDFs and custom code within the MaxCompute ecosystem, ensuring efficient data processing and analysis capabilities for enterprise users.
SEE ALSO
odpscmd(1), odps-function(1), odps-sql(1)