Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增功能自动断开colab的bug #78

Open
dylanZk1 opened this issue Dec 10, 2023 · 6 comments
Open

新增功能自动断开colab的bug #78

dylanZk1 opened this issue Dec 10, 2023 · 6 comments

Comments

@dylanZk1
Copy link

我看了下代码,你发起下载请求后,就直接调用sleep函数了,这样会导致下载请求无法发起,必须强制暂停代码运行才行,我用的是Google浏览器,其余Chromium浏览器也会出现这种情况

@Ayanaminn
Copy link
Owner

我今天也注意到这个问题了,稍后会抽空修复。感谢。

@Ayanaminn
Copy link
Owner

自动断开这个功能我暂时关闭了,因为和google.colab.files.download这个方法有冲突。
files.download会等待当前的cell执行完,这样的话会出现一直计时,然后就先执行断开连接的情况。
目前没想到什么好办法,如果您有什么思路清务必指教。

@dylanZk1
Copy link
Author

我看了下files.py的源码,里面是用 js 异步构建了一个download函数(async),里面需要根据Kernel ID返回的数据量判断是否成功,而你在python环境下是直接同步调用sleep函数,让kernel无法返回数据,导致在调用js的download函数时一直在for循环中判断。所以不能直接在代码中调用sleep。我看到里面用 js 创建了一个channel,当下载发起之后,可以通过调用channel的send方法发消息给python程序,然后在python程序中添加接收即可,具体的代码可以参考:https://stackoverflow.com/questions/63263921/is-there-a-way-to-register-a-message-handler-callback-on-a-google-colab-kernel-c
屏幕截图 2023-12-10 200817

@dylanZk1
Copy link
Author

@dylanZk1
Copy link
Author

还有一个,就是下载成压缩包的功能,建议可以添加一个选项,让用户选择是否压缩,因为有的用户可能并没有压缩的习惯或打算。当然只是建议

@Ayanaminn
Copy link
Owner

还有一个,就是下载成压缩包的功能,建议可以添加一个选项,让用户选择是否压缩,因为有的用户可能并没有压缩的习惯或打算。当然只是建议

嗯,这个我也觉得,今天改了一下,只有多个文件才以压缩包的形式下载

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants