https://dagster.io/ logo
Title
n

nickvazz

11/07/2022, 6:35 PM
noticed a bug 🐛 with notebooks in dagit, looks like https://github.com/dagster-io/dagster/pull/9894 introduced a view notebook button (which looks like it should only work for notable notebooks?) that opens a new tab to the filepath of the notebook specified i.e.
C:/some/path/notebook.ipynb
which does not render -- curious if this is supposed to happen or if I am supposed to pass some
fsspec
with the dagstermill op/asset for it to be able to link/properly render 🤷
r

rex

11/07/2022, 6:52 PM
@jamie could you take a look?
j

jamie

11/07/2022, 6:56 PM
hey @nickvazz - the view notebook button should be able to determine if the path is a URL (ie to a noteable notebook) or a filepath on your local machine. If it’s a URL it’ll open the url in a new tab, otherwise it’ll attempt to render the file within dagit in a little popup modal. There might be a bug with dagit determining if the file is a URL or not. To confirm, your notebook is at a path like
C:/some/path/notebook.ipynb
and when you click the View Notebook button, it opens a new tab thats blank?
n

nickvazz

11/07/2022, 6:58 PM
To confirm, your notebook is at a path like
C:/some/path/notebook.ipynb
and when you click the View Notebook button, it opens a new tab thats blank?
Yep that's correct
j

jamie

11/07/2022, 6:59 PM
ok good to know. are you hardcoding the path to the notebook when you define the dagstermill op/asset?
n

nickvazz

11/07/2022, 7:00 PM
Yep -- reusing a papermill template we already had
j

jamie

11/07/2022, 7:00 PM
@dish could there be a discrepancy between how the URL check in dagit treats paths on windows machines vs mac/linux paths?
d

dish

11/07/2022, 7:24 PM
Seems possible, but I think that would be a python issue if it’s failing to find the file —
download_notebook
may not currently know how to make use of a windows path
j

jamie

11/09/2022, 5:35 PM
hey @nickvazz, just want to let you know that I haven’t forgotten about this. I’m hoping to find time today or tomorrow to try to replicate the issue and i’ll keep you updated on what i find
n

nickvazz

11/09/2022, 5:36 PM
awesome thank you! 🙂
j

jamie

11/16/2022, 4:18 PM
hey @nickvazz finally got some time to take a look at this. I don’t have a windows computer, but I was able to replicate the issue on my mac. It seems like when i set the
notebook_path
to
file:///Users/path/to/my/notebook.ipynb
the URL conversion we do in javascript doesn’t work. I think it’s because we’re giving a “fully qualified” path to the notebook. when I supply the path
/Users/path/to/my/notebook.ipynb
the notebook renders in dagit correctly. We should probably have better support for the
file://
path, but in the meantime, i think if you remove the
C:
from your path it might work. Additionally, we have a utility
file_relative_path
that you can use in your python code to supply the path to your notebook without needing to give the full path. It looks like this
my_notebook = define_dagstermill_asset(
    name="my_notebook",
    notebook_path=file_relative_path(__file__, "../notebooks/my_notebook.ipynb"),
)
n

nickvazz

11/17/2022, 12:41 AM
Still acts a little wonky, it will open to the file but its blank, if you click the url, it seems to auto-add the
file:///
and render the notebook as json.
he notebook renders in dagit correctly.
Is it supposed to render in dagit rather than opening a new browser tab to the file?
j

jamie

11/17/2022, 12:43 AM
if notebook_path is a file in the local file system it should render in dagit. if it’s a qualified url (like if you put google.com as the notebook_path) it will open the notebook in a new tab. I’ll try to get my hands on a windows computer to test this out tomorrow
n

nickvazz

11/17/2022, 12:44 AM
if notebook_path is a file in the local file system it should render in dagit.
Oh that would be cool! It seems like even with the relative path it adds back in the
C:/
to the filepath
(thanks for the help btw)
j

jamie

11/17/2022, 12:46 AM
ok! can you take a screenshot of the description in the right side panel (should be right above the view notebook button)? a screenshot of what you see when you click the button too would be helpful. you can dm them or block out any info if there’s stuff you don’t want to share in the public channel. it’ll help me make sure that my reproduction matches what you’re seeing
👍 1