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


Python CmdlineParser.global_instance方法代码示例

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


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

示例1: find_deps_cli

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def find_deps_cli():
    '''
    Finds all tasks on all paths from provided CLI task
    '''
    cmdline_args = sys.argv[1:]
    with CmdlineParser.global_instance(cmdline_args) as cp:
        return find_deps(cp.get_task_obj(), upstream().family)
开发者ID:Tarrasch,项目名称:luigi,代码行数:9,代码来源:deps.py

示例2: _run

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def _run(cmdline_args=None, main_task_cls=None,
         worker_scheduler_factory=None, use_dynamic_argparse=None, local_scheduler=False):
    """
    Please dont use. Instead use `luigi` binary.

    Run from cmdline using argparse.

    :param cmdline_args:
    :param main_task_cls:
    :param worker_scheduler_factory:
    :param use_dynamic_argparse: Deprecated and ignored
    :param local_scheduler:
    """
    if use_dynamic_argparse is not None:
        warnings.warn("use_dynamic_argparse is deprecated, don't set it.",
                      DeprecationWarning, stacklevel=2)
    if cmdline_args is None:
        cmdline_args = sys.argv[1:]

    if main_task_cls:
        cmdline_args.insert(0, main_task_cls.task_family)
    if local_scheduler:
        cmdline_args.insert(0, '--local-scheduler')

    with CmdlineParser.global_instance(cmdline_args) as cp:
        return _schedule_and_run([cp.get_task_obj()], worker_scheduler_factory)
开发者ID:realgo,项目名称:luigi,代码行数:28,代码来源:interface.py

示例3: find_deps_cli

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def find_deps_cli():
    '''
    Finds all tasks on all paths from provided CLI task
    '''
    cmdline_args = sys.argv[1:]
    with CmdlineParser.global_instance(cmdline_args) as cp:
        task_cls = cp.get_task_cls()
        task = task_cls()
        upstream_task_family = upstream().family
        return find_deps(task, upstream_task_family)
开发者ID:nirmeshk,项目名称:luigi,代码行数:12,代码来源:deps.py

示例4: _run

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def _run(cmdline_args=None, main_task_cls=None,
         worker_scheduler_factory=None, use_dynamic_argparse=None, local_scheduler=False, detailed_summary=False):
    if use_dynamic_argparse is not None:
        warnings.warn("use_dynamic_argparse is deprecated, don't set it.",
                      DeprecationWarning, stacklevel=2)
    if cmdline_args is None:
        cmdline_args = sys.argv[1:]

    if main_task_cls:
        cmdline_args.insert(0, main_task_cls.task_family)
    if local_scheduler:
        cmdline_args.append('--local-scheduler')
    with CmdlineParser.global_instance(cmdline_args) as cp:
        return _schedule_and_run([cp.get_task_obj()], worker_scheduler_factory)
开发者ID:PeteW,项目名称:luigi,代码行数:16,代码来源:interface.py

示例5: main

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def main(luigi_module_file, last_task, first_task, dry_run, luigi_args):
    """
    Determines which files are generated by tasks on a "path" of a luigi task graph and deletes them.
    This is useful to force-run one or several tasks as if the output targets already
    exist, luigi will not execute the task.

    For example if there are 4 tasks A -> B -> C -> D ('->' meaning 'requires')
    and the code of task C changed, one might to rerun tasks C, B and A. Hence,
    the output files generated by these three tasks should get deleted first.

    :param luigi_module_file: python module name containing luigi tasks (needs to be on python path)
    :param last_task: last task in topological ordering ('A' in example)
    :param first_task: first task in topological ordering ('C' in example)
    :param dry_run: don't delete files, just output paths
    :param luigi_args: arguments passed to luigi
    """

    luigi_cmd = ['--module', luigi_module_file, last_task]

    if luigi_args:
        luigi_cmd.extend(luigi_args)

    with CmdlineParser.global_instance(luigi_cmd) as cp:
        task = cp.get_task_obj()

        print("Determining output files on path {} to {}".format(first_task, last_task))
        files = walk_tree(task, first_task)

        files_to_delete = {f for f in files if os.path.exists(f)}

        if not files_to_delete:
            print("Nothing to delete.")

        for f in files_to_delete:
            if not dry_run:
                print("Removing {}".format(f))
                os.unlink(f)
            else:
                print("Would remove {}".format(f))
开发者ID:BD2KGenomics,项目名称:brca-exchange,代码行数:41,代码来源:prune_output_files.py

示例6: in_parse

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def in_parse(cmds, deferred_computation):
    with CmdlineParser.global_instance(cmds):
        deferred_computation()
开发者ID:nirmeshk,项目名称:luigi,代码行数:5,代码来源:helpers.py

示例7: wrapper

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
 def wrapper(*args, **kwargs):
     with CmdlineParser.global_instance(self.cmds, allow_override=True):
         return fun(*args, **kwargs)
开发者ID:nirmeshk,项目名称:luigi,代码行数:5,代码来源:helpers.py

示例8: in_parse

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def in_parse(cmds, deferred_computation):
    with CmdlineParser.global_instance(cmds) as cp:
        deferred_computation(cp.get_task_obj())
开发者ID:01-,项目名称:luigi,代码行数:5,代码来源:helpers.py

示例9: main

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import global_instance [as 别名]
def main():
    cmdline_args = sys.argv[1:]
    with CmdlineParser.global_instance(cmdline_args) as cp:
        task = cp.get_task_obj()
        print(print_tree(task))
开发者ID:Houzz,项目名称:luigi,代码行数:7,代码来源:deps_tree.py


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