What's the expected behaviour from a Notebook's Content Manager?

29 views
Skip to first unread message

Ian Stuart

unread,
Jul 3, 2017, 3:31:01 AM7/3/17
to Project Jupyter
I have subclassed ContentManager, to use a locally provide Cloud Infrastructure, however I'm not getting what I would expect as "Expected Behaviour" -

I would expect a cell with 
f = open('my_file.txt', w)
f
.write('hello world')
f
.close
to write to the cloud storage, not local file-store

If the subclass passes all the unit-tests for ContentManager, is this a reasonable expectation?

NB:
The "jupyter_notebook_config.py" is setting the content manager:
c.NotebookApp.contents_manager_class = 'swiftcontents.SwiftContentsManager'


Yuvi Panda

unread,
Jul 3, 2017, 3:37:48 AM7/3/17
to Project Jupyter
As I Understand It, the behavior you expect is the expected one - the
contents manager only changes what is available in the notebook
interface, not what's available to the code running inside the
notebook. IMO this exact confusion (what looks like files to you
aren't actually files) is what limits contents manager use outside of
specific circumstances - standard programming language functions for
dealing with files don't work as expected...

To get the behavior you need you should use a linux FUSE setup or
something similar. For Swift, try https://github.com/ovh/svfs? That
operates at a deeper level (Linux Kernel provides FUSE functionality),
and so things like `open` will work as expected (for the most part!)
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/03c22c8b-63e4-4cca-8221-58748083b2e0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Yuvi Panda T
http://yuvi.in/blog

Ian Stuart

unread,
Jul 3, 2017, 9:08:07 AM7/3/17
to Project Jupyter, yuvi...@gmail.com
Darn.... OK - thanks for that.


On Monday, 3 July 2017 08:37:48 UTC+1, Yuvi Panda wrote:
As I Understand It, the behavior you expect is the expected one - the
contents manager only changes what is available in the notebook
interface, not what's available to the code running inside the
notebook. IMO this exact confusion (what looks like files to you
aren't actually files) is what limits contents manager use outside of
specific circumstances - standard programming language functions for
dealing with files don't work as expected...

To get the behavior you need you should use a linux FUSE setup or
something similar. For Swift, try https://github.com/ovh/svfs? That
operates at a deeper level (Linux Kernel provides FUSE functionality),
and so things like `open` will work as expected (for the most part!)

On Mon, Jul 3, 2017 at 12:31 AM, 'Ian Stuart' via Project Jupyter
<jup...@googlegroups.com> wrote:
> I have subclassed ContentManager, to use a locally provide Cloud
> Infrastructure, however I'm not getting what I would expect as "Expected
> Behaviour" -
>
> I would expect a cell with
> f = open('my_file.txt', w)
> f.write('hello world')
> f.close
> to write to the cloud storage, not local file-store




Reply all
Reply to author
Forward
0 new messages