【问题标题】:How can I keep a PBSCluster running?如何保持 PBSCluster 运行?
【发布时间】:2020-12-31 05:18:44
【问题描述】:

我可以访问运行 PBS Pro 的集群,并希望保持 PBSCluster 实例在头节点上运行。我当前(显然已损坏)的脚本是:

import dask_jobqueue

from paths import get_temp_dir


def main():
    temp_dir = get_temp_dir()
    scheduler_options = {'scheduler_file': temp_dir / 'scheduler.json'}
    cluster = dask_jobqueue.PBSCluster(cores=24, memory='100GB', processes=1, scheduler_options=scheduler_options)


if __name__ == '__main__':
    main()

这个脚本显然被破坏了,因为在创建集群后,main() 函数退出并且集群被销毁。 我想我必须调用某种execute_io_loop 函数,但我在API 中找不到任何东西。

那么,我怎样才能让我的 PBSCluster 保持活力?

【问题讨论】:

    标签: dask dask-distributed dask-jobqueue


    【解决方案1】:

    我认为文档中的Python API (advanced) 部分可能是尝试解决此问题的好方法。

    请注意,这是一个如何创建调度程序和工作程序的示例,但我假设该逻辑可以以类似的方式用于您的案例。

    import asyncio
    
    async def create_cluster():
        temp_dir = get_temp_dir()
        scheduler_options = {'scheduler_file': temp_dir / 'scheduler.json'}
        cluster = dask_jobqueue.PBSCluster(cores=24, memory='100GB', processes=1, scheduler_options=scheduler_options)
    
    if __name__ == "__main__":
        asyncio.get_event_loop().run_until_complete(create_cluster())
    

    您可能需要稍微更改代码,但它应该让您的 create_cluster 一直运行直到完成。

    让我知道这是否适合你。

    【讨论】:

    • 我不确定您提供的代码是否正确(可能缺少一些“等待”或“返回”),但感谢您提供链接!那是我正在寻找的文档页面。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多