luigi学习-luigi的配置文件

一、luigi配置文件的加载顺序

/etc/luigi/client.cfg

luigi.cfg

LUIGI_CONFIG_PATH环境变量

二、配置文件分节

配置文件被分为了多个section,每一个控制着不同方面的配置

三、利用配置文件来给参数赋值

如果你有这样的一个类:

class DailyReport(luigi.contrib.hadoop.JobTask):
    date = luigi.DateParameter(default=datetime.date.today())
    # ...

 你可以使用配置文件的方式赋值,并且将覆盖参数的默认值:

[DailyReport]
date=2012-01-01

四、Configuration classes

配置文件的内容可以作为全局的变量来使用

配置文件:

[mysection]
option=hello
intoption=123

使用python代码来读取:

import luigi

# Config classes should be camel cased
class mysection(luigi.Config):
    option = luigi.Parameter(default='world')
    intoption = luigi.IntParameter(default=555)

mysection().option
mysection().intoption

 五、配置选项

5.1hadoop的配置项

commad=hadoop  #hadoop作业提交的命令,默认值就是hadoop

python-executable=python  #运行python程序的命令,默认值就是python

scheduler=fair  #hadoop的作业调度器,可以是fair或者capacity,默认值是fair

streaming-jar  #streaming jar的路径,必须制定

version=cdh4  #hadoop集群的版本,可以是"cdh3","cdh4"或者"apache1",默认值是"cdh4"

原文地址:https://www.cnblogs.com/dongdone/p/5703780.html