Synapse : Execute the Magic Command (%run) Notebook from Pipeline

1.7k Views Asked by At

The magic commands work perfectly in Notebooks. However, While running the same notebook from the Synapse pipeline, it could not locate the notebook's path.

Appreciate your help

{
    "errorCode": "6002",
    "message": "MagicUsageError: Cannot read notebook Externals/Helper. The possible reason is that the notebook doesn't exist. More details please visit https://go.microsoft.com/fwlink/?linkid=2173018\n--> PartnerException: Exception of type 'Microsoft.Analytics.SynapseNotebookService.Infrastructure.Exceptions.ClientExceptions.PartnerException' was thrown.",
    "failureType": "UserError",
    "target": "sample",
    "details": []
}
2

There are 2 best solutions below

3
Gio Mac On

if you are using GIT you need to publish the notebook first. After that the reference over the pipeline works.

Best regards Gio

1
Pratik Lad On

I tried to reproduce your scenario in my environment and got similar error. enter image description here The cause of error is the path you provided to the %run magic command %run command currently only supports to pass a absolute path

  • If your notebook is not in any folder, you can give path as %run /notebook name
  • If your notebook is present in any folder you can give path as %run /folder name/notebook name

And make sure you publish all the changes.

Here I am calling Notebook2 from Notebook1 enter image description here

Notebook ran successfully. enter image description here