Add rclone install check only if call fails.#569
Conversation
| ) | ||
|
|
||
|
|
||
| def check_rclone_with_default_call() -> bool: |
There was a problem hiding this comment.
This change just swaps the order of the functions so that the called function is under the calling function
|
Hey @JoeZiminski, this looks good. It is completely extendable to the Popen method (in the function that awaits the Popen call). However, I'm not sure of the performance benefits. When I ran it locally, the difference wasn't very noticeable. So, we might as well just keep the check that runs on DataShuttle Checking rclone installed on failing commands is really good in general. I'm all in for that. However, #560 (the part where it returns sub-001 in case rclone is not installed), reflects a deeper problem and the "rclone not installed" is just one manifestation. So, checking if rclone installed or not would be more of a quick fix. Another way this problem manifests is, if you setup a project with SSH connection method and don't setup the connection (so that remote rclone calls fail), and then if you try to use suggest next sub or ses with Here's why I it happens, |
|
Thanks @cs7-shrey! There was an error in the previous implementation, the checking function called On Windows, spawning a new process is much slower than UNIX, in part because UNIX systems use a 'fork' method by default in which the new process shares the memory space of the old process unless it writes to it, in which case it is copied ('copy-on-write'). On windows, the method spawns an entirely new process with dedicated memory etc. which is slower. On my slightly older laptop, unfortunately this lag is quite noticeable and makes the start-up process of datashuttle a little jarring. It's a shame because it creates all kinds of problems, including having to think about #571. I wish the world used UNIX systems! |
|
Hey @JoeZiminski, I might have missed out on trying that part somehow. I tried it now and it works fine. I agree on the unix/windows part, sorry i was a bit biased with my operating system. Also, what do you think about raising error in the |
|
Hey @cs7-shrey sorry for the late reply, no worries I wouldn't have noticed if I wasn't on Windows! For This is mainly related to transfers, return codes, at the moment the working mode is for the transfer to run and the user checks the logs to see whether transfer was successful. This is not ideal and should be handled better (#432, #536) but explicitly handling error codes can be left until these issues. We can think about this |
4dba40d to
03f1115
Compare
89d963f to
708371d
Compare
closes #560. Previously a check for
rcloneinstall was performed on datashuttle startup if the project did not exist. The assumption was the first time the program is used, ifrcloneis not installed the install can be reminded. However, this doesn't make much sense because new environments are often created, but this doesn't mean a new project will be made.The problem with the
rcloneinstall check is that it spawns a subprocess to callrclonewhich is slow, so it cannot be arbitrarily called. The reason it is not always called at program start up is because it creates an annoying lag when opening a project.The solution here is to only check the rclone install if the rclone call has actually failed. This means we can avoid the overhead of checking up-front, and only incur it if the
rclonecall has failed (in which case, a short delay is not an issue).No docs are required for this, it would be ideal to test it but it would be quite complex in the CI (having to uninstall
rclonein the test environment) and is not easily mocked because of the subprocess call. In this case no tests are added, it is not critical and will come up in general day-to-day test usage if it fails.@cs7-shrey the only problem with this is it might cause issues for the
Popenmethod of calling rclone? Maybe it is not possible to take this approach in that function?