将daskjobqueue与SGECluster.adapt()一起使用,并在任何工作进程处于活动状态之前提交任务

2024-05-15 03:56:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我已使用正确的设置设置了SGECluster调度程序,并确认我可以连接到仪表板并将作业提交到我的sge队列。我想使用adapt方法根据传入任务负载来调整工作人员的数量。这些任务通常不相关,因此可以由单个工作人员在其自己的流程中运行

我注意到,在工作人员可用之前,调度程序似乎不会注册任务(至少在仪表板中)。如果第一个worker需要一些时间才能可用,并且我将任务提交给调度程序,它将不知道需要扩展,因此额外的worker将最终位于队列的后面。是否可以提示调度程序在第一个工作进程连接到调度程序之前识别任务已到达,并适当地将工作进程的请求放入队列

如果我使用scale(n)而不是adapt,我可以让工人排队

cluster = SGECluster(
    queue=queue_name,
    memory=maximum_memory,
    processes=worker_processes,  
    env_extra=env_list,
    scheduler_options=scheduler_options,
    log_directory=log_dir,
    job_name=name,
    walltime=walltime,
    resource_spec=f"{mem_spec}={maximum_memory}",
    job_extra=job_extra_list,
)

# if the first worker takes ages to begin running, then only one worker will be requested
# and tasks submitted in the interim do not adjust the scheduler behaviour
# cluster.adapt(minimum=1, maximum=20)

# queues up the requested workers straight away but doesn't adapt to load
cluster.scale(20)

Tags: thename程序队列job调度extrascheduler

热门问题