Luigi-运行时未完成的%s [英] Luigi - Unfulfilled %s at run time

查看:102
本文介绍了Luigi-运行时未完成的%s的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以一种非常简单的方式来学习luigi的工作原理.就像一个新手一样,我想出了这段代码

I am trying to learn in a very simple way how luigi works. Just as a newbie I came up with this code

import luigi

class class1(luigi.Task):

  def requires(self):
     return class2()

  def output(self):
    return luigi.LocalTarget('class1.txt')

 def run(self):
    print 'IN class A'


class class2(luigi.Task): 

  def requires(self):
     return []

  def output(self):
     return luigi.LocalTarget('class2.txt')


if __name__ == '__main__':
  luigi.run()

在命令提示符下运行此命令会提示错误

Running this in command prompt gives error saying

raise RuntimeError('Unfulfilled %s at run time: %s' % (deps, ',     

推荐答案

之所以会发生这种情况,是因为您为class2定义了一个输出,但是从不创建它.

This happens because you define an output for class2 but never create it.

让我们分解一下...

Let's break it down...

运行时

python file.py class2 --local-scheduler

luigi会问:

  • class2的输出是否已经在磁盘上?否
  • 检查class2的依赖项:无
  • 执行run方法(默认情况下为空方法pass)
  • run方法未返回错误,因此作业成功完成.
  • is the output of class2 already on disk? NO
  • check dependencies of class2: NONE
  • execute the run method (by default it's and empty method pass)
  • run method didn't return errors, so job finishes successfully.

但是,在运行时

python file.py class1 --local-scheduler

路易吉将:

  • class1的输出是否已经在磁盘上?否
  • 检查任务依赖性:是:class2
  • 暂停以检查class2的状态
    • class2的输出是否在磁盘上?否
    • 运行class2-> 运行->完成,没有错误
    • class2的输出是否在磁盘上?否->引发错误
    • is the output of class1 already on disk? NO
    • check task dependencies: YES: class2
    • pause to check status of class2
      • is the output of class2 on disk? NO
      • run class2 -> running -> done without errors
      • is the output of class2 on disk? NO -> raise error

      luigi永远不会运行任务,除非满足其先前的所有依赖关系. (即它们的输出在文件系统上)

      luigi never runs a task unless all of its previous dependencies are met. (i.e. their output is on the file system)

      这篇关于Luigi-运行时未完成的%s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆