diff --git a/docs/source/tutorials/raptor.ipynb b/docs/source/tutorials/raptor.ipynb index 19a9e9a14e..5acd0a019d 100644 --- a/docs/source/tutorials/raptor.ipynb +++ b/docs/source/tutorials/raptor.ipynb @@ -152,7 +152,7 @@ "source": [ "### Task execution\n", "\n", - "At this point we have the pilot set up and running, we started the master task, and the master will upon initialization start the worker tasks: the RAPTOR overlay is now ready to execute a Python function. The default RAPTOR Worker has a built-in test function which you can use for testing purpose:\n" + "At this point we have the pilot set up and running, we started the master task, and the master will upon initialization start the worker tasks: the RAPTOR overlay is now ready to execute a Python function. Note that a function must be decorated with the `rp.pythontask` decorator for it to be callable as a raptor function.\n" ] }, { @@ -169,10 +169,17 @@ }, "outputs": [], "source": [ + "# function for raptor to execute\n", + "@rp.pythontask\n", + "def msg(val: int):\n", + " if(val %2 == 0):\n", + " print('Regular message')\n", + " else:\n", + " print(f'This is a very odd message: {val}')\n", + "\n", "# create a minimal executable task\n", "td = rp.TaskDescription({'mode' : rp.TASK_FUNCTION,\n", - " 'function' : 'test', \n", - " 'args' : [1, 2]})\n", + " 'function' : msg(3)})\n", "task = raptor.submit_tasks([td])[0]" ] },