The core resource for LAS data processing is the queue: it provides all the CPU, GPU, and memory required for running operators and scripts. The development machine, task management, and workflow are all built on the queue, each addressing the challenges of debugging, batch execution, and complex scheduling in their respective phases. This article introduces the dependencies and collaboration methods among the four core modules of LAS data processing—queue, development machine, task management, and workflow.
The core modules of LAS data processing (development machine / task management / workflow) rely on the underlying queue and read scripts, container images, data, and operator templates from external resources.
The division of responsibilities and dependencies among the four modules is as follows:
Module | Problems solved | Relationship with other modules |
|---|---|---|
Queue | Provides CPU / GPU computing resources | Shared among DevBox, tasks, and workflows; divided into dedicated queues (EMR Serverless) and compute queues (LAS queues), with dedicated queues officially recommended |
DevBox | Interactive debugging of operator code | Runs on the specified queue, reads TOS / image repository / dataset; after debugging the code, migrate it to task management for batch execution |
Task management | Submit batch or periodic tasks | Select a queue to consume resources; supports three task types: Daft, Python, and Spark; operator templates and environment variable lists can be obtained from the operator marketplace |
Workflow | Multi-task DAG orchestration and scheduling | Organize multiple tasks into a DAG with dependencies, and submit task instances to the queue sequentially upon triggering |
The complete workflow from creating a queue to viewing results, including debugging and scheduling branches (Daft / Python / Spark), typically consists of the following six steps:
Main workflow: Create a queue → Create a development machine → Upload code to TOS → Create a task → Submit to the queue for execution → View task instances. The upper branches represent three trigger methods, and the lower dashed line indicates the parameter iteration loop.
Taking the offline operator "Video Key Frame Extraction" provided by the LAS Operator Plaza as an example, this section brings together all the modules mentioned above and demonstrates how to run an operator on the queue.
warning
When custom images are selected, tasks currently do not support running on dedicated queues (EMR Serverless queues); in this case, switch to LAS compute queues.
Refer to the sample code for "Video Key Frame Extraction" in the Operator Marketplace, save the script as test.py, with a structure as shown below (refer to the Operator Marketplace for the actual structure):
# test.py —— Example of an offline operator for video keyframe extraction import os import daft # 1. Read parameters specified by the operator marketplace from environment variables input_uri = os.getenv("INPUT_URI") # Input video directory, for example tos://your-bucket/videos/ output_uri = os.getenv("OUTPUT_URI") # Keyframe output directory frame_rate = float(os.getenv("FRAME_RATE", "1.0")) # Frame extraction frequency (frames/second) model_path = os.getenv("MODEL_PATH", "/mnt/data/keyframe_model") # 2. Use Daft to read the video and call the keyframe extraction operator df = daft.read_video(input_uri) df = df.with_column( "keyframes", df["video"].apply_udf("keyframe_extract", fps=frame_rate, model=model_path), ) # 3. Write the results back to TOS df.write_parquet(output_uri)
Upload test.py to the TOS bucket in the same region as LAS, placing it at the designated path:
tosutil cp ./test.py tos://test/test.py
This example uses tos://test/ test.py as the script address and /test/ as the mount path within the task; for actual use, replace these with your own bucket name and directory.
Go to LAS Console > Data Processing > Task Management > Create Task and fill in the basic information and environment information as follows:
Configuration items | Example values |
|---|---|
Name |
|
Task type | Daft (preferred for multimodal big data; Python can also be used for lightweight scripts) |
Image | Built-in image: select the official LAS Daft image, or use a custom image recommended by the Operator Plaza |
Storage path mounting | Mount type TOS, source path |
After mounting is complete, /test/ test.py inside the container at task startup will directly point to the script on TOS; any subsequent script changes only require re-uploading to TOS, without recreating the task.
Open the "Video Key Frame Extraction" page in the LAS Operator Marketplace, and copy the key-value pairs listed in the "Environment Variables" section directly into the task's environment variable form. For example, in this case (refer to the Operator Marketplace for actual values):
Key | Value (example) |
|---|---|
|
|
|
|
|
|
|
|
warning
The case of the environment variable Key must be exactly the same as in the Operator Plaza, so that os.getenv("...") in the script can read the value. If the Value contains spaces or special characters, it is recommended to paste it in text mode for centralized input to avoid truncation in single-line KV input.
Enter the actual execution statement in the entry command field. Since the script is already mounted at /test/ test.py, the most straightforward way to write it is:
python /test/test.py
In the Resources section on the right side of the page, select the queue prepared in Step 1 (for example, las-gpu-queue-a), and set the number of CPUs, memory, and GPUs for the Driver/Executor as needed. After confirming everything is correct, click Execute, and the task instance will immediately enter the queue for scheduling.
Each time the task is triggered, a record will be generated on the "Task Instance" page. The execution status can be confirmed from three aspects:
Running / Succeeded / Failed; when failed, hover the mouse to see a brief reason.After the task succeeds, the extraction results will be written back to TOS according to OUTPUT_URI; use tosutil ls tos://your-bucket/keyframes/ or the object storage console to verify the output files.
After running the first instance successfully, it is usually necessary to make adjustments based on the scale of the business. The common directions for parameter tuning are as follows:
Adjust dimensions | Typical scenarios | Adjust position |
|---|---|---|
Script parameters | Switch frame extraction algorithm and add post-processing logic | Modify |
Environment variables | Switch input/output buckets and adjust frame extraction frequency | Task details > Edit > Environment variables |
Resource specifications | More GPUs or larger memory are required as video volume increases | When clicking "Execute", adjust the CPU/GPU/memory of the Driver/Executor in the pop-up window |
Scheduling policy | Frame extraction needs to be scheduled every day at midnight | Task details > Advanced settings > Periodic scheduling, configure the effective time and interval |
Multi-task orchestration | Feature extraction and database import are required after frame extraction | In "Workflow", chain multiple tasks into a DAG. For details, see Workflow |