tencent cloud

Feedback

Resource Management

Last updated: 2025-02-24 19:34:39

    Feature Overview

    The resource management feature supports uploading local files of .jar, .zip, .csv, .sh, .py, .kjb, .ktr to the platform's COS bucket, which is used to support subsequent script development, computational task development, function development, and other feature scenarios.

    Creating a Resource

    Upload local resource files to WeData for management, providing the capability to create custom functions during the data development process.
    1. Log in to WeData Console.
    2. Click Project List in the left menu to find the target project for which you want to operate the resource management feature.
    3. After selecting a project, click to enter the Data Development module.
    4. Click Resource Management in the left menu.
    5. In the resource management directory, click
    
    to expand the operation menu and then select Create Resource.
    
    6. Upload the local resource file in the pop-up, enter the resource name, and select the resource directory folder and storage path.
    
    7. After the configuration is completed, click OK, and the script resource can be maintained in the resource management feature, and detailed information can be viewed on the corresponding resource page.
    

    Resource Management

    1. Click
    
    icon to create a new folder or resource item.
    2. Click
    
    icon to delete records in batches.
    3. Click
    
    icon to open, rename, delete, or download resources.
    4. Double-click the created resource to view its detailed information, including resource name, resource type, storage path, file size, user creation, creation time, and provide the feature to reupload the resource.
    5. Batch Delete: After clicking Batch Delete, users can select the resource packages they wish to delete and click Yes to proceed with the deletion.
    Note
    Referenced resources cannot be deleted.
    
    6. Creating a Resource: After clicking Create Resource, users need to configure the file name and file address. After selecting the file to upload, click OK to complete the resource upload.

    Example Of Referenced Resource

    Use Python Files In Resource Files In Python

    1. Develop a local Python script named demo.py file.
    ## demo.py
    def print_method():
    print("hello, world")
    
    if __name__ == "__main__":
    print("This is demo .py ")
    print_method()
    2. Upload to the folder in the resource file of WeData, for example, the folder jaydata.
    
    
    
    3. Create a new Python task in the Orchestration Space, for example, python_demo. At the same time, open the resource file, and select Referenced Resource in More Operations, which will automatically put the file path of the current resource into the Python task code.
    For example: ##@resource_reference("jaydata/demo.py")
    Reference code for different task types:
    Task Type
    Code Format
    Development Space: SQL
    Orchestration Space: HiveSQL, JDBC SQL, SparkSQL, DLCSQL, Impala, TCHouse-P, Trino, TChouse-X
    --@resource_reference("resource management path/resource name")
    Development Space: Shell, Python
    Orchestration Space: Shell, Python
    ##@resource_reference("resource management path/resource name")
    
    
    
    Here is an example of how to import demo.py as a library in Python and call the print_method method in the demo library.
    ##@resource_reference("jaydata/demo.py")
    import sys
    import os
    sys.path.append(os.path.dirname(os.path.abspath('jaydata/demo.py')))
    import demo
    demo.print_method()
    

    Calling Python In Shell

    Create a new Shell task, open the resource file, and select Referenced Resource in More Operations, which will automatically put the file path of the current resource into the Shell task code.
    For example: ##@resource_reference("jaydata/demo.py")
    1. Execute Python commands in Shell, run Python scripts.
    ##@resource_reference ("jaydata/demo.py")
    #!/bin/bash
    python jaydata/demo.py
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support