LinuxCommandLibrary

odpscmd-resource

TLDR

[Interactive] Show resources in the current project

$ list resources;
copy

[Interactive] Add file resource
$ add file [filename] as [alias];
copy

[Interactive] Add archive resource
$ add archive [archive.tar.gz] as [alias];
copy

[Interactive] Add .jar resource
$ add jar [package.jar];
copy

[Interactive] Add .py resource
$ add py [script.py];
copy

[Interactive] Delete resource
$ drop resource [resource_name];
copy

SYNOPSIS

add {file|py|jar|archive} <local_path> [as <alias>] [-f];
add table <table_name> [partition (<spec>)] [as <alias>] [-f];
list resources;
get resource <resource_name> <local_path>;
remove resource <resource_name>;

PARAMETERS

add
    Uploads a local file or registers a project table as a resource in MaxCompute.

list
    Provides a comprehensive list of all resources currently uploaded to the active project.

get
    Downloads a specified resource from the project to the user's local file system.

remove
    Deletes the specified resource from the MaxCompute project.

-f
    Force flag; overwrites an existing resource if a resource with the same name already exists.

as
    Specifies a different name (alias) for the resource within the MaxCompute environment.

DESCRIPTION

The odpscmd-resource suite of commands is used to manage resources within Alibaba Cloud MaxCompute (formerly ODPS). Resources are essential components required for executing User-Defined Functions (UDFs) and MapReduce jobs. These resources can include local files, Python scripts, Java JAR packages, compressed archives, and even MaxCompute tables.

Through these commands, users can upload local assets to the MaxCompute project, list existing resources, download resources to a local directory, or delete them when they are no longer needed. Resources are project-scoped and are subject to size limitations and access control permissions. Properly managing resources is a prerequisite for extending MaxCompute functionality beyond standard SQL.

CAVEATS

Resource sizes are generally capped (e.g., 500MB for individual files). Adding large resources frequently can impact project storage quotas. Ensure that the resource name is unique within the project unless using the -f flag to overwrite.

SUPPORTED RESOURCE TYPES

file: Generic file types.
py: Python script files for UDFs.
jar: Java library files for MapReduce or UDFs.
archive: Compressed files (zip/tgz/tar.gz/jar) that are automatically uncompressed in the compute environment.
table: Existing MaxCompute tables used as read-only inputs for jobs.

HISTORY

Developed as part of the MaxCompute Console (odpscmd) to facilitate the lifecycle management of dependencies required for distributed computing tasks. It has evolved from simple file uploads to supporting complex partitioned table resources and automated alias mapping.

SEE ALSO

odpscmd-table(1), odpscmd-function(1), odpscmd-instance(1)

Copied to clipboard