当前位置: 首页>>代码示例>>Python>>正文


Python luigi.IntParameter方法代码示例

本文整理汇总了Python中luigi.IntParameter方法的典型用法代码示例。如果您正苦于以下问题:Python luigi.IntParameter方法的具体用法?Python luigi.IntParameter怎么用?Python luigi.IntParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在luigi的用法示例。


在下文中一共展示了luigi.IntParameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_repr

# 需要导入模块: import luigi [as 别名]
# 或者: from luigi import IntParameter [as 别名]
def test_repr(self):
        class _SubTask(gokart.TaskOnKart):
            task_namespace = __name__

        class _Task(gokart.TaskOnKart):
            task_namespace = __name__
            int_param = luigi.IntParameter()
            task_param = TaskInstanceParameter()
            list_task_param = ListTaskInstanceParameter()

        task = _Task(int_param=1, task_param=_SubTask(), list_task_param=[_SubTask(), _SubTask()])
        sub_task_id = _SubTask().make_unique_id()
        expected = f'{__name__}._Task(int_param=1, task_param={__name__}._SubTask({sub_task_id}), ' \
            f'list_task_param=[{__name__}._SubTask({sub_task_id}), {__name__}._SubTask({sub_task_id})])'
        self.assertEqual(expected, str(task)) 
开发者ID:m3dev,项目名称:gokart,代码行数:17,代码来源:test_task_on_kart.py

示例2: test_params

# 需要导入模块: import luigi [as 别名]
# 或者: from luigi import IntParameter [as 别名]
def test_params(cleanup):
    class TaskParam(d6tflow.tasks.TaskCache):
        nrows = luigi.IntParameter(default=10)
        def run(self):
            self.save(pd.DataFrame({'a':range(self.nrows)}))

    t1 = TaskParam(); t2 = TaskParam(nrows=20);
    assert not t1.complete(); assert not t2.complete();

    t1.run()
    assert t1.complete(); assert not t2.complete(); 
开发者ID:d6t,项目名称:d6tflow,代码行数:13,代码来源:main.py

示例3: test_task

# 需要导入模块: import luigi [as 别名]
# 或者: from luigi import IntParameter [as 别名]
def test_task(self,cleanup):

        e = d6tflow.pipes.FlowExport('utest-flowexport',tasks=Task1All(),write_dir=cfg_write_dir)
        e.generate()

        code = readfile(e.write_dir/e.write_filename_tasks)
        assert code == '''
import d6tflow
import luigi
import datetime

class Task1All(d6tflow.tasks.TaskCache):
    external=True
    persist=['data']
    idx=luigi.parameter.IntParameter(default=1)
    idx2=luigi.parameter.Parameter(default='test')
    idx3=luigi.parameter.Parameter(default='test3')

'''

        code = readfile(e.write_dir/e.write_filename_run)
        assert code == '''
# shared d6tflow workflow, see https://d6tflow.readthedocs.io/en/latest/collaborate.html
import d6tflow.pipes
import tasks_d6tpipe
import datetime

d6tflow.pipes.init('utest-flowexport',profile='default') # to customize see https://d6tflow.readthedocs.io/en/latest/d6tflow.html#d6tflow.pipes.init
d6tflow.pipes.get_pipe('utest-flowexport').pull()

# task output is loaded below, for more details see https://d6tflow.readthedocs.io/en/latest/tasks.html#load-output-data
df_task1all = tasks_d6tpipe.Task1All(idx=1, idx2='test', idx3='test3', ).outputLoad()
''' 
开发者ID:d6t,项目名称:d6tflow,代码行数:35,代码来源:test_export.py

示例4: test_task2

# 需要导入模块: import luigi [as 别名]
# 或者: from luigi import IntParameter [as 别名]
def test_task2(self,cleanup):

        e = d6tflow.pipes.FlowExport('utest-flowexport',tasks=[Task1A(),Task1All()],write_dir=cfg_write_dir)
        e.generate()

        code = readfile(e.write_dir/e.write_filename_tasks)
        assert code == '''
import d6tflow
import luigi
import datetime

class Task1All(d6tflow.tasks.TaskCache):
    external=True
    persist=['data']
    idx=luigi.parameter.IntParameter(default=1)
    idx2=luigi.parameter.Parameter(default='test')
    idx3=luigi.parameter.Parameter(default='test3')

class Task1A(d6tflow.tasks.TaskCache):
    external=True
    persist=['df', 'df2']
    idx=luigi.parameter.IntParameter(default=1)
    idx2=luigi.parameter.Parameter(default='test')

'''

        code = readfile(e.write_dir/e.write_filename_run)
        assert code == '''
# shared d6tflow workflow, see https://d6tflow.readthedocs.io/en/latest/collaborate.html
import d6tflow.pipes
import tasks_d6tpipe
import datetime

d6tflow.pipes.init('utest-flowexport',profile='default') # to customize see https://d6tflow.readthedocs.io/en/latest/d6tflow.html#d6tflow.pipes.init
d6tflow.pipes.get_pipe('utest-flowexport').pull()

# task output is loaded below, for more details see https://d6tflow.readthedocs.io/en/latest/tasks.html#load-output-data
df_task1all = tasks_d6tpipe.Task1All(idx=1, idx2='test', idx3='test3', ).outputLoad()
df_task1a_df, df_task1a_df2, = tasks_d6tpipe.Task1A(idx=1, idx2='test', ).outputLoad()
''' 
开发者ID:d6t,项目名称:d6tflow,代码行数:42,代码来源:test_export.py

示例5: test_flow

# 需要导入模块: import luigi [as 别名]
# 或者: from luigi import IntParameter [as 别名]
def test_flow(self,cleanup):

        e = d6tflow.pipes.FlowExport('utest-flowexport',flows=Task1All(),write_dir=cfg_write_dir)
        e.generate()

        code = readfile(e.write_dir/e.write_filename_tasks)
        assert code == '''
import d6tflow
import luigi
import datetime

class Task1A(d6tflow.tasks.TaskCache):
    external=True
    persist=['df', 'df2']
    idx=luigi.parameter.IntParameter(default=1)
    idx2=luigi.parameter.Parameter(default='test')

class Task1B(d6tflow.tasks.TaskCache):
    external=True
    persist=['df', 'df2']
    idx3=luigi.parameter.Parameter(default='test3')

class Task1All(d6tflow.tasks.TaskCache):
    external=True
    persist=['data']
    idx=luigi.parameter.IntParameter(default=1)
    idx2=luigi.parameter.Parameter(default='test')
    idx3=luigi.parameter.Parameter(default='test3')

'''

        code = readfile(e.write_dir/e.write_filename_run)
        assert code == '''
# shared d6tflow workflow, see https://d6tflow.readthedocs.io/en/latest/collaborate.html
import d6tflow.pipes
import tasks_d6tpipe
import datetime

d6tflow.pipes.init('utest-flowexport',profile='default') # to customize see https://d6tflow.readthedocs.io/en/latest/d6tflow.html#d6tflow.pipes.init
d6tflow.pipes.get_pipe('utest-flowexport').pull()

# task output is loaded below, for more details see https://d6tflow.readthedocs.io/en/latest/tasks.html#load-output-data
df_task1a_df, df_task1a_df2, = tasks_d6tpipe.Task1A(idx=1, idx2='test', ).outputLoad()
df_task1b_df, df_task1b_df2, = tasks_d6tpipe.Task1B(idx3='test3', ).outputLoad()
df_task1all = tasks_d6tpipe.Task1All(idx=1, idx2='test', idx3='test3', ).outputLoad()
''' 
开发者ID:d6t,项目名称:d6tflow,代码行数:48,代码来源:test_export.py


注:本文中的luigi.IntParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。