Python Remote control Mount: Transport endpoint is not connected

What is the problem you are having with rclone?

I have a rclone process running with rclone rcd --rc-no-auth
I cannot mount using python remote control:

    rclone = Rclone()
    res = rclone.rpc("mount/mount", fs="lakefs:apple",

When run this code I get {} and not error. But when I try to ls /dev/shm/tmp I get: ls: cannot access 'tmp': Transport endpoint is not connected

If I use rclone rc mount/mount fs="lakefs:apple" mountPoint="/dev/shm/tmp" then I can browse /dev/shm/tmp as expected. My lakefs is a S3 compatible server

There is no error nor message in rclone rc

Other weird symptom: once I mount with rclone rc mount/mount fs="lakefs:apple" mountPoint="/dev/shm/tmp", I can list mount with rclone rc mount/listmounts but the python equivalent give {}

Run the command 'rclone version' and share the full output of the command.

$ rclone --version
rclone v1.63.1-DEV
- os/version: opensuse-leap 15.4 (64 bit)
- os/kernel: 5.14.21-150400.24.60-default (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.18.1
- go/linking: dynamic
- go/tags: none

I built rclone after a git checkout v1.63.1 with go build
The is built with go build --buildmode=c-shared -o
When I tried go build --buildmode=c-shared -o : I get a without error. But when I use that file with python binding I get:
AttributeError: /home/user/softs/rclone/ undefined symbol: RcloneRPC

I am not sure how to build from the local git folder nor how to download one

Note: I am not familiar with go.

That indicates that the mount started but got stopped.

Remember the rclone code needs to keep running as long as you want the mount to be active. Something like this

    rclone = Rclone()
    res = rclone.rpc("mount/mount", fs="lakefs:apple",

Leave that running and check the mount.

I'd probably use asnycio with like run forever instead of sleep. However OP was vague in what use case he needs it.

Ooh right. In my use case, I want the mount to stay until the next unmount command, not until the python script end, similar to the behavior of "rclone rc mount/mount" which return right away. How do I achieve that with python ?

Python or not the idea is the same.

You need rclone rcd running and listening to rc commands.

Then you can use HTTP(s) interface to communicate with rcd server:

curl -X POST 'http://IP:PORT/mount/mount?fs=remote:&mountPoint=path/to/mount

curl -X POST 'http://IP:PORT/mount/unmount?mountPoint=path/to/mount

I do have a rclone rcd running all the time in another terminal in the example above.

What I did not get is that in python, the mount only last the time the python script is alive while the rclone rc return right away with the mount happening .

What is the pro/cons using versus python+requests ? Does rclone rc use HTTP get/post behind the scene ? Or something more efficient ?

You need to have something running to run the mount.

That could be

  • rclone rcd
  • your python script with

But it has to stay running!

rclone rc uses HTTP. I wouldn't worry about efficiency until you are running 1,000 requests per second - http and rclone rcd is plenty fast!

I finally got it now: rclone inside python script run as a standalone rclone process, independently to other rclone instance if any ... The rclone in python use the same API syntax as rclone rc.
I though the python rclone is doing the same thing as rclone rc and communicate with a running rclone rcd

In my use case, where I need to leave the mount point alive, I will probably start rclone rcd first, then use python requests to do the mount/unmount subsequently.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.