Configure a notebook node
In task orchestration, you can use a notebook node to periodically run .ipynb files to automate tasks such as generating reports or training AI models.
Prerequisites
Complete the following operations:
-
Create a workspace. For more information, see Step 1: Create and enter a workspace.
-
Add a compute resource. For more information, see Step 4: Add a compute resource.
-
Configure notebook storage. For more information, see Step 5: Configure a user storage space.
-
Create a notebook file (
.ipynbfile). For more information, see Create a Notebook file. -
Tag a cell with
parameters.In the Add Tag box, enter
parametersto make the cell parameterizable.a = 1
Procedure
Log in to DMS 5.0.
-
Move the pointer over the
icon in the upper-left corner and choose . NoteIf you use the DMS console in normal mode, choose in the top navigation bar.
-
Create a task flow.
Click Create Task Flow. In the dialog box, configure Business Scenario and Task Flow Name, and then click OK.
-
Create a notebook node.
From the Task Type list on the left side of the canvas, drag Notebook to a blank area on the canvas.
-
Configure the notebook node.
Double-click the node to open its configuration page. Configure parameters such as Workspace, Compute Resource, and Notebook file.
The Type of a runtime parameter can be
string,number, orboolean.NoteThe key of a runtime parameter corresponds to a variable name in the notebook file. The value can be a constant or a variable, such as the system variable
${bizdate}. -
Configure the scheduling cycle for the task flow.
At the bottom of the task flow configuration page, click Task Flow Information and configure the parameters in the Scheduling Settings section. The following scheduling types are available:
-
Time-based scheduling: Runs the task at a specific time or on a recurring schedule (UTC+8). For more information, see Configure time-based scheduling.
-
Event-based scheduling: Triggers the task based on an external event. For more information, see Configure event-based scheduling.
-
-
Test the node.
If the last line of the run log shows
status SUCCEEDED, the test run is successful. The following example shows a successful run:2024-09-23 17:44:02[GMT+08:00] INFO - Finishing job j_299*** at 172708464**** with status SUCCEEDEDNote-
DMS generates a new
.ipynbfile each time a notebook node runs. -
If the test run fails (the run log shows
status FAILED), check the log to find the cause, fix the configuration, and then try again.
-
Notebook run results
-
In the upper-right corner of the task flow configuration page, click Go to O&M.
NoteAlternatively, on the task flow list page, click O&M.
-
On the Run History tab, select a trigger type, such as a scheduled trigger or manual trigger.
-
Click View Notebook.
This button is in the Actions column for the sub-task on the run history page.
The system redirects you to the generated
.ipynbfile.# Cell [1] (parameters) a = 1 # Cell [2] (injected-parameters) # Parameters a = "2024-09-22" # Cell [3] print(a) # Output: 2024-09-22