This topic describes how to create an offline shell task in Dataphin.
Procedure
In the top navigation bar of the Dataphin homepage, choose Develop > Data Development.
On the Development page, select Project from the top menu bar (for Dev-Prod mode, you need to select an environment).
In the left-side navigation pane, choose Data Processing > Compute Tasks. In the Compute Tasks list, click the
icon and select Shell.In the Create shell task dialog box, configure the following parameters.
Parameter
Description
Task name
Enter a name for the offline task.
The name can be up to 256 characters long and cannot contain the following characters: vertical bar (|), forward slash (/), backslash (\), colon (:), question mark (?), angle brackets (<>), asterisk (*), or double quotation mark (").
Scheduling type
Select the scheduling type for the task. The scheduling type options include:
Periodic task: The system automatically schedules this task to run periodically.
Manual task: You must trigger this task manually.
Select directory
Select the directory where the task will be stored.
If a directory does not exist, you can create one by clicking New Folder. To do so:
Above the compute task list on the left, click the
icon to open the New Folder dialog box.In the New Folder dialog box, enter a folder Name and, if needed, Select Directory to specify its location.
Click OK.
Use template
Turn on the Use Template switch to use a code template. If you turn this switch on, you must also Select Template and Template Version.
Using a code template can improve development efficiency. The template code is read-only. You only need to configure the template parameters to complete the code. For more information, see Create an offline compute template.
Python third-party package
Select one or more Python third-party packages to import. For more information, see Install a Python Module.
NoteAfter adding a third-party module, you must reference it in the Python third-party package section of the task properties before you can import the module in your code.
Description
Enter a brief description for the task, up to 1,000 characters.
Click OK.
In the code editor on the shell task tab, write the code for the offline shell task. After writing the code, click Run above the editor.
On the right-side panel, click Properties. In the Properties panel, configure settings such as Basic Information, runtime resources, Python third-party package, resource reference, runtime parameter, scheduling properties (for periodic tasks), scheduling dependency (for periodic tasks), run configuration, and resource configuration.
Basic information
Set the task's name, owner, and description. For configuration instructions, see Configure basic task information.
Runtime resources
Specifies the CPU and memory allocated to the task. The default is 0.1 vCPU and 256 MB. For configuration instructions, see Configure runtime resources for an offline task.
Python third-party package
Select the Python third-party packages to use. For more information, see Install a Python Module.
Resource reference
Select the resources to reference. The system downloads the selected resources to the task's working directory, preserving their original filenames. For more information, see Upload and reference resources.
Runtime parameter
If your task uses parameters, you can assign values to them in this section. When the task runs, the system automatically replaces the parameters with their assigned values. For configuration instructions, see Configure and use node parameters.
Scheduling properties (for periodic tasks)
If the task is a periodic task, you must configure its scheduling properties in addition to its Basic Information. For configuration instructions, see Configure scheduling properties.
Scheduling dependency (for periodic tasks)
If the task is a periodic task, you must configure its scheduling dependencies in addition to its Basic Information. For configuration instructions, see Configure scheduling dependencies.
Run configuration
You can configure a task-level run timeout and a retry policy. If not configured, the task inherits the default settings at the tenant level. For configuration instructions, see Configure run settings for a compute task.
Resource configuration
You can configure a scheduling resource group for the compute task. When scheduled, the task consumes resources from that group's quota. For configuration instructions, see Configure resources for a compute task.
On the current shell task tab, save and commit the task.
Click the
icon above the code editor to save the code.Click the
icon above the code editor to commit the code.
On the Commit Details page, confirm the Content to commit and the Pre-check results, and then enter remarks. For more information, see Commit an offline compute task.
After you confirm the details, click OK and Commit.
Next steps
If you use Dev-Prod mode, you must go to the release list and release the task to the production environment after you commit the task. For more information, see Manage release tasks.
If your development mode is Basic mode, a shell task can be scheduled in the production environment once it is successfully submitted. You can go to the O&M Center to view your published tasks. For more information, see View and manage script tasks, View and manage manual tasks.