最简单去运行一个luigi task的方式是通过luigi命令行工具。

示例代码:

# my_module.py, available in your sys.path
import luigi class MyTask(luigi.Task):
x = luigi.IntParameter()
y = luigi.IntParameter(default=45) def run(self):
print self.x + self.y

在命令行上运行:

(my_python_env)[root@hadoop26 pythonCode]# PYTHONPATH='' luigi --module my_module MyTask --x  --y  --local-scheduler

或者可以选择这种方式运行:

(my_python_env)[root@hadoop26 pythonCode]# python -m luigi --module my_module MyTask --x  --local-scheduler

注意:如果一个参数的名字中含有'_',在命令行中你需要替代为'-'。例如MyTask有一个参数名字是'my_parameter',你需要这么赋值:

luigi --module my_module MyTask --my-parameter 100 --local-scheduler

luigi学习7--running from command line的更多相关文章

  1. Error running 'xxx': Command line is too long. Shorten command line for xxx

    跑单元测试时,报错如下: Error running 'xxx': Command line is too long. Shorten command line for xxx 解决方案: 在项目所在 ...

  2. 运行springboot项目报错 Error running 'ResourceApplication': Command line is too long. Shorten comma

    方法1 IDEA 运行报错:Error running '***': Command line is too long 技术标签: IDEA     Error running 'Test': Com ...

  3. idea报错:Error running $classname: Command line is too long. Shorten command line for $classname.

    Command line is too long 打印的变量太长了,超过了限制,这都会报错...我只想知道idea基于什么原理会报这个错... 解决 1.按照提示修改该类的配置,选择jar manif ...

  4. idea启动springboot项目报Error running 'ServiceStarter': Command line is too long. Shorten command line for ServiceStarter or also for Application

    解决办法:在.idea文件夹下面的workspace.xml中的 <component name="PropertiesComponent">标签下面添加: <p ...

  5. idea 启动 Error running 'XxGatewayApplication': Command line is too long. Shorten command line for XxGatewayApplication or also for Spring Boot default

    在idea workspace里 <component name="PropertiesComponent">标签下加入 <property name=" ...

  6. Error running 'App': Command line is too long. Shorten command line for App or also for Spring Boot default configuration.

    找到标签 <component name="PropertiesComponent">.在标签里加一行  : <property name="dynam ...

  7. IDEA命令行缩短器助你解决此问题:Command line is too long. Shorten command line...

    生命太短暂,不要去做一些根本没有人想要的东西.本文已被 https://www.yourbatman.cn 收录,里面一并有Spring技术栈.MyBatis.JVM.中间件等小而美的专栏供以免费学习 ...

  8. idea运行main方法报错,提示Shorten command line for xxx

    在Intell IDEA运行main函数的时候遇到了如下错误: Error running' xxxxxx': Command line is too long. Shorten command li ...

  9. IntelliJ IDEA 运行项目的时候提示 Command line is too long 错误

    在 IntelliJ IDEA 项目运行的时候收到了下面的错误提示: Error running 'Application': Command line is too long. Shorten co ...

  10. Intellij IDEA中Springboot启动报Command line is too long错误

    启动报错:Error running 'CmsFrontApplication': Command line is too long. Shorten command line for CmsFron ...

随机推荐

  1. JAVA中集合类的使用

    总的说来常用的集合类有两大类:Collection 和 Map 1) Collection接口有List和Set两大类子接口,List有ArrayList.LinkedList.Vector子类,Se ...

  2. 浅析JAVA_HOME,CLASSPATH和PATH的作用

    1,设置JAVA_HOME:  java的目录一.为了方便引用,比如,你JDK安装在C:\ProgramFiles\Java\jdk1.7.0目录里,则设置JAVA_HOME为该目录路径, 那么以后你 ...

  3. GridView内容<br />换行

    if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[].Text = Server.HtmlDecode(e.Row.Cell ...

  4. (*medium)LeetCode 211.Add and Search Word - Data structure design

    Design a data structure that supports the following two operations: void addWord(word) bool search(w ...

  5. C++ STL小知识

    五种迭代器: 在STL中,迭代器主要分为5类,分别是:输入迭代器.输出迭代器.前向迭代器.双向迭代器和随机访问迭代器. 输入迭代器 :只读,支持++.==.!=: 输出迭代器 :只写,支持++: 前向 ...

  6. .NET调用Java写的WebServices(可能会碰到的问题)

    1)net中定义的的WebService(返回值和参数都是自定义对象)可以被Java识别并调用,可是在Java中定义的WebService(返回值和参数都是自定义对象),C#客户端可以识别到自定义对象 ...

  7. 菜鸟-手把手教你把Acegi应用到实际项目中(3)

    这一节我们将要了解的是AnonymousProcessingFilter.RememberMeProcessingFilter和LogoutFilter三个过滤器. 1.AnonymousProces ...

  8. 项目积累——CSS应用

    <tr onmouseover=" this.style.backgroundColor= '#E0FFFF' "  onmouseout="this.style. ...

  9. SQL在指定列后添加新的列

    ALTER TABLE `MR_CustomerShopFuture` ADD COLUMN `ProcessID` INT(11) DEFAULT '0' COMMENT '审核流程ID';

  10. HDU 4738 Caocao's Bridges

    Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...