You can use datasets in nodes such as Shell nodes, Python nodes, and Notebook nodes to read data from and write data to File Storage (NAS) or Object Storage (OSS) during data development. You can also mount a dataset to a personal development environment instance when you create it.
We recommend that you first read Manage datasets to learn how to create a dataset.
Background
When you develop data in DataWorks, you can use the dataset feature to read and write data stored in OSS and NAS. This feature supports the creation and management of datasets and their versions. Version management lets you track data versions and quickly revert to a previous version if a new one has issues. This helps ensure that your business operations run smoothly.
Limitations
-
Datasets are supported only in Data Studio.
-
Resource group restrictions: To access a dataset from a data development node, you must use a Serverless resource group.
-
Object restrictions: Currently, datasets are supported only for Shell nodes, Python nodes, Notebook basic development, and personal development environments. You can mount a maximum of 5 datasets to each object.
-
Storage type restrictions: DataWorks supports datasets in Object Storage (OSS) and NFS-based File Storage (NAS).
-
Permission restrictions: If a dataset mount point is read-only, you cannot modify or delete its folders or files. Such attempts result in a permission error.
Use datasets in a node
This topic uses an example to demonstrate how to use a dataset in a node. In this example, we create an OSS dataset in DataWorks, mount the OSS path oss://datasets-oss.oss-cn-shanghai.aliyuncs.com/dataset01/v1/ to the DataWorks dataset mount path /mnt/data/dataset01, and then perform read and write operations on the dataset within a node.
Prerequisites: Create a dataset
-
Create a bucket or Create a file system.
This example uses an OSS dataset. We create a bucket named
datasets-ossand a directory named/dataset01/v1in the China (Shanghai) region. -
In this example, we create an OSS dataset named
datasets-ossand mount the OSS pathoss://datasets-oss.oss-cn-shanghai.aliyuncs.com/dataset01/v1/to/mnt/data/dataset01.
1. Configure a dataset for a node
In the Run Configuration of a Shell node or Python node, configure the information for the dataset datasets-oss.
-
Before you deploy the node, add the dataset in Scheduling Settings.
-
To use a dataset, you must allocate at least 0.5 CU of compute resources to the node.

|
Parameter |
Description |
|
Datasets |
Configure the datasets that can be accessed in the code of the current node.
In this example, select the OSS dataset |
|
Mount Path |
Configure the path used to access the dataset in the code of the current node. The Default Mount Path specified when the dataset was defined is automatically populated. Important This is the path specified when the dataset was defined. If multiple datasets are mounted to the same node, the mount paths must not conflict. |
|
Advanced Settings |
Optional. You can specify the tools and parameters for reading from and writing to OSS data in JSON format, or specify the configurations for reading from and writing to a NAS file system.
|
|
Read Only |
By default, you can read data from and write data to the dataset in the current node. If the dataset is set to read-only in the current node, you cannot write data to the dataset mount directory in the node code. Any write operation will result in a permission error. |
2. Use a dataset in a node
This example uses a Shell node. After you associate an OSS dataset with a Shell node, you can manage OSS data in the Shell node code as if it were local files. The following example uses the default ossfs 2.0 tool to upload a file file01.txt to the mount path /mnt/data/dataset01 of the OSS dataset datasets-oss and write data to it.
Code sample:
echo "Hello World" > /mnt/data/dataset01/file01.txt
ls -tl /mnt/data/dataset01
If the error Job Submit Failed! submit job failed directly! Caused by: execute task failed, exception: [103:ILLEGAL_TASK]:Task with dataset need 0.5cu at least! occurs at runtime, the CU allocation for the task is insufficient. Adjust the compute CU of the resource group and allocate at least 0.5 CU.
3. Verify data writes in OSS
After the dataset is configured in the node is completed, the file is automatically written to the OSS storage path that corresponds to the dataset mount path. You can go to the OSS storage path to view the file written from the DataWorks node. In this example, the mount path /mnt/data/dataset01 of the OSS dataset datasets-oss corresponds to the storage path oss://datasets-oss.oss-cn-shanghai.aliyuncs.com/dataset01/v1/. The following shows an example of data written to this OSS path.

Use datasets in a personal development environment
After a dataset is defined, you can mount the storage of a DataWorks dataset to a personal development environment instance when you create or modify it. Then, you can directly read data from the dataset in the terminal or notebook of the personal directory.
Prerequisites: Create a dataset
-
This example uses a NAS dataset. We create a NAS dataset named
datasets-nasin the China (Shanghai) region and mount the NAS pathnas://****.cn-shanghai.nas.aliyuncs.com/mnt/dataset02/v1/to/mnt/data/dataset02.
1. Configure a dataset for a personal development environment
Create a personal development environment instance and select the NAS dataset datasets-nas that you created.

|
Parameter |
Description |
|
Datasets |
Configure the datasets that can be accessed in the code of the current node. Make sure that the VPC selected for the personal development environment instance is connected to the NAS mount target. In this example, select the NAS dataset |
|
Mount Path |
Configure the path used to access the dataset in the code of the personal development environment instance. In this example, the NAS dataset path Important This is the path specified when the dataset was defined. If multiple datasets are mounted to the same personal development environment instance, the mount paths must not conflict. |
|
Advanced Settings |
Optional. You can specify the configurations (nasOptions parameter) for accessing NFS-based File Storage (NAS) in JSON format. The following shows the default configuration. You can also refer to Manually mount an NFS file system to customize parameter values. Important
|
|
Read Only |
By default, you can read data from and write data to the dataset in the current node. If the dataset is set to read-only in the current node, you cannot write data to the dataset mount directory in the node code. Any write operation will result in a permission error. |
2. Read a dataset in a notebook
-
At the top of the data development page, switch to the personal development environment instance, and then create a Notebook development.
-
Configure the following content in the notebook.
-
Write data to a specified path in the dataset.
import os # Define target path and file name file_path = "/mnt/data/dataset02/file02.txt" # Ensure the directory exists (create it if it does not exist) os.makedirs(os.path.dirname(file_path),exist_ok=True) # Write content content = "Hello World!" try: with open(file_path, "w", encoding="utf-8") as file: file.write(content) print(f"File written successfully: {file_path}") except Exception as e: print(f"Write failed: {str(e)}") -
Read data from a specified path in the dataset.
file_path = "/mnt/data/dataset02/file02.txt" with open(file_path, "r") as file: content = file.read() content
-
-
Run the two Python code snippets separately.
NoteBefore running the code, confirm the Python kernel. This example uses Python 3.11.9.

3. Configure scheduling
On the right side of the Notebook node, click Scheduling Settings and add dataset-related options. The parameter settings are the same as those configured when you created the personal development environment instance.
Advanced configuration examples
When you configure a dataset, you can set the advanced configuration to customize related parameters in JSON format:
-
When you configure a dataset for a node, you can set the advanced configuration to specify the tools and parameters for reading from and writing to OSS data in JSON format, or specify the configurations for reading from and writing to a NAS file system.
-
When you configure a dataset for a personal development environment, you can set the advanced parameters to specify the configurations for reading from and writing to a NAS file system in JSON format.
The following are configuration examples:
Use ossfs 2.0 to mount and access OSS
ossfs 2.0 is a client designed for high-performance access to OSS (object storage) through mounting. It excels at sequential read and write operations and can fully leverage the high-bandwidth advantage of OSS. It is suitable for scenarios that require high sequential read and write performance, such as AI training and big data processing. These workloads mainly involve sequential and random reads, sequential (append-only) writes, and do not require full POSIX semantics.
In , you can set advanced parameters. Separate multiple configurations with commas (,). For information about the advanced parameters and more configurations, see ossfs 2.0 mount options. The following are some common scenario examples:
-
Data source remains unchanged during a task: If all files to be read are not modified during the read process, you can configure a larger cache time to reduce the number of metadata requests. A typical scenario is reading a batch of existing old files and generating a batch of new files after processing.
{"mountOssType":"ossfs", "attr_timeout": "7200"} -
Fast read and write: Use a smaller metadata cache time to balance cache efficiency and data freshness.
{"mountOssType":"ossfs", "attr_timeout": "3", "negative_timeout":"0"} -
Read/write consistency for distributed tasks: ossfs updates file data based on metadata caching by default. Use the following configuration to achieve a synchronized view across multiple nodes.
{ "mountOssType":"ossfs","negative_timeout": "0", "close_to_open":"false"} -
OOM caused by opening too many files simultaneously: When task concurrency is high and a large number of files are opened simultaneously, OOM (out of memory) issues may occur. Use the following configuration to mitigate memory pressure.
{"mountOssType":"ossfs","readdirplus": "false", "inode_cache_eviction_threshold":"300000"}
Use ossfs 1.0 to mount and access OSS
ossfs 1.0 allows you to mount an OSS storage space as a local file system on a Linux system. Compared with ossfs 2.0, ossfs 1.0 supports more comprehensive file operations. If you encounter file operation incompatibility issues after mounting a directory with ossfs 2.0, try using ossfs 1.0.
For the specific parameters required for ossfs 1.0 mounting, see ossfs 1.0 mount options.
Use JindoFuse to mount and access OSS
Use the Configure JindoFuse component to mount an OSS dataset to a specified path in the container. This tool is suitable for the following scenarios:
-
You want to read OSS data as if it were local data, or the dataset is small enough to benefit from JindoFuse's local cache acceleration.
-
You need to write data to OSS.
In , you can set advanced parameters. Separate multiple configurations with commas (,). The following is only an example of the configuration method. For parameter descriptions and more configurations, see JindoFuse User Guide and Mount and access with JindoFuse.
Currently, DataWorks supports only parameters in the key=value format.
{
"mountOssType":"jindofuse",
"fs.oss.download.thread.concurrency": "2x the number of CPU cores",
"fs.oss.upload.thread.concurrency": "2x the number of CPU cores",
"attr_timeout": 3,
"entry_timeout": 0,
"negative_timeout": 0
}Use NAS datasets
When the dataset is of the NAS type, you can specify the configurations (nasOptions parameter) for accessing NFS-based File Storage (NAS). The following shows the default configuration. You can also refer to Manually mount an NFS file system to customize parameter values.
-
You can currently mount only NFS-based NAS.
-
NAS currently supports only one advanced configuration parameter:
nasOptions. To customize NAS mount parameters, set the advanced configuration to{"nasOptions":"<parameter1=value>,<parameter2=value>,..."}.
{"nasOptions":"vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport"}