Python 在luigi中使用自定义配置配置管道

Python 在luigi中使用自定义配置配置管道,python,config,luigi,Python,Config,Luigi,以下是我问题的一个很好的部分答案: 我有相同的管道,但我想用自定义配置(非luigi.cfg)对其进行配置 配置文件如下所示: [servername] username=name password=password [servername2] username=name2 password=password2 [servername3] username=name3 password=password3 所以我开始是这样的: class configure(luigi.WrapperT

以下是我问题的一个很好的部分答案:

我有相同的管道,但我想用自定义配置(luigi.cfg)对其进行配置

配置文件如下所示:

[servername]
username=name
password=password

[servername2]
username=name2
password=password2

[servername3]
username=name3
password=password3
所以我开始是这样的:

class configure(luigi.WrapperTask):
    configname = luigi.Parameter()
        def run(self):
            with self.input().open('r') as file ini:
                for i in sections:
                    # read section from ini 

        def requires(self):
            tasks = []
            # here I also need for-loop
            return tasks
请帮助实施: FOR-LOOP 1.读取ini文件 2.阅读下一节 3.执行工作流 4.转到1
/FOR-LOOP

你有没有想过?你有没有想过?
class configure(luigi.WrapperTask):
    configname = luigi.Parameter()
        def run(self):
            with self.input().open('r') as file ini:
                for i in sections:
                    # read section from ini 

        def requires(self):
            tasks = []
            # here I also need for-loop
            return tasks