如何避免在Luigi中同时运行多个工作人员的特定任务

时间:2015-10-30 06:18:55

标签: python matplotlib luigi

我使用Luigi构建数据分析任务,包括使用matplotlib进行绘图。

似乎matplotlib绘图的并发运行会导致一个问题,由于某种原因导致问题过早地从任务中返回,什么都不做。 (看起来这是matplotlib的问题,虽然我可能错了。)

要解决此问题,我希望避免同时为该绘图任务运行多个工作程序,同时在多个工作程序中运行其他任务。我怎么能这样做?

1 个答案:

答案 0 :(得分:6)

您可以使用resources。在=> ALTER TABLE customers alter id type uuid using id::uuid; ERROR: foreign key constraint "users_customer_id_fkey" cannot be implemented DETAIL: Key columns "customer_id" and "id" are of incompatible types: character varying and uuid. 上配置资源,如:

/etc/luigi/client.cfg

然后,以这种方式修改你的任务:

[resources]
mathplotlib: 1

如果您有运行luigi worker的多台计算机并且您希望所有计算机上只有一名工作程序可能正在使用给定资源,那么您可以查看this solution