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


Python invoke.task方法代码示例

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


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

示例1: load_all

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def load_all(ctx):
    """
    default task called if `invoke` is run without args

    This is the main tasks that import all the datas into postgres and start the tiles generation process
    """
    if not ctx.osm.file and not ctx.osm.url:
        raise Exception("you should provide a osm.file variable or osm.url variable")

    lock_path = get_import_lock_path(ctx)
    with FileLock(lock_path) as lock:
        prepare_db(ctx)
        load_osm(ctx)
        load_additional_data(ctx)
        run_post_sql_scripts(ctx)

        if ctx.wikidata.stats.enabled:
            override_wikidata_weight_functions(ctx)

        rotate_database(ctx)
        generate_tiles(ctx)
        init_osm_update(ctx) 
开发者ID:QwantResearch,项目名称:kartotherian_docker,代码行数:24,代码来源:tasks.py

示例2: build

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def build(ctx):
    ctx.run("sphinx-apidoc -f -o docs/source/source_code .")
    ctx.run("sphinx-build -b html -d docs/build/doctrees -D latex_paper_size=a4 docs/source docs/build/html")


# import os
#
# from utils import chdir, BASE_DIR
# DOCS_DIR = os.path.join(BASE_DIR, 'docs/')
#
#
# @task
# def build_translation(ctx):
#     with chdir(DOCS_DIR):
#         # ctx.run('make gettext') to create initial locales
#         # ctx.run('sphinx-intl update -p build/locale -l es') to create initial locales
#         ctx.run('sphinx-intl update -p build/locale') 
开发者ID:iago1460,项目名称:django-radio,代码行数:19,代码来源:docs.py

示例3: release

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def release(ctx, sdist=True, wheel=True, sign=True, dry_run=False):
    """
    Wraps invocations.packaging.publish to add baked-in docs folder.
    """
    # Build docs first. Use terribad workaround pending invoke #146
    ctx.run("inv docs", pty=True, hide=False)
    # Move the built docs into where Epydocs used to live
    target = 'docs'
    rmtree(target, ignore_errors=True)
    # TODO: make it easier to yank out this config val from the docs coll
    copytree('sites/docs/_build', target)
    # Publish
    publish(ctx, sdist=sdist, wheel=wheel, sign=sign, dry_run=dry_run)
    # Remind
    print("\n\nDon't forget to update RTD's versions page for new minor "
          "releases!")


# TODO: "replace one task with another" needs a better public API, this is
# using unpublished internals & skips all the stuff add_task() does re:
# aliasing, defaults etc. 
开发者ID:hpe-storage,项目名称:python-hpedockerplugin,代码行数:23,代码来源:tasks.py

示例4: install

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def install(ctx):
    ctx.run('python3 setup.py install')

# @task(clean, build)
# def sdist(ctx):
#     ctx.run('python3 setup.py sdist')

# @task(clean, build)
# def bdist(ctx):
#     ctx.run('python3 setup.py bdist') 
开发者ID:FabriceSalvaire,项目名称:PySpice,代码行数:12,代码来源:release.py

示例5: watch_docs

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def watch_docs(ctx, browse=False):
    """Run build the docs when a file changes."""
    try:
        import sphinx_autobuild  # noqa
    except ImportError:
        print('ERROR: watch task requires the sphinx_autobuild package.')
        print('Install it with:')
        print('    pip install sphinx-autobuild')
        sys.exit(1)
    ctx.run('sphinx-autobuild {0} {1} {2} -z marshmallow'.format(
        '--open-browser' if browse else '', docs_dir, build_dir), echo=True, pty=True) 
开发者ID:jmcarp,项目名称:flask-apispec,代码行数:13,代码来源:tasks.py

示例6: watch_docs

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def watch_docs(ctx):
    """Run build the docs when a file changes."""
    try:
        import sphinx_autobuild  # noqa
    except ImportError:
        print('ERROR: watch task requires the sphinx_autobuild package.')
        print('Install it with:')
        print('    pip install sphinx-autobuild')
        sys.exit(1)
    docs(ctx)
    ctx.run('sphinx-autobuild {} {}'.format(docs_dir, build_dir), pty=True) 
开发者ID:jmcarp,项目名称:nplusone,代码行数:13,代码来源:tasks.py

示例7: reindex_poi_geometries

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def reindex_poi_geometries(ctx):
    """
    Successive updates tend to bloat some of the geometry indexes significantly.
    This task triggers a forced REINDEX after the update has been applied.
    """
    if not ctx.osm_update.reindex_poi_geometries:
        return
    _execute_sql(ctx, "REINDEX (VERBOSE) INDEX osm_poi_polygon_geom", db=ctx.pg.database) 
开发者ID:QwantResearch,项目名称:kartotherian_docker,代码行数:10,代码来源:tasks.py

示例8: run_osm_update

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def run_osm_update(ctx):
    if not check_generated_cache(ctx.generated_files_dir):
        sys.exit(1)

    change_file_path = f"{ctx.update_tiles_dir}/changes.osc.gz"
    lock_path = get_import_lock_path(ctx)
    with FileLock(lock_path) as lock:
        current_osm_timestamp = read_current_state(ctx)
        try:
            osmupdate_opts = _get_osmupdate_options(ctx)
            ctx.run(
                f'osmupdate {osmupdate_opts} {current_osm_timestamp} {change_file_path}'
            )
        except Failure as exc:
            if exc.result.return_code == 21:
                logging.info('OSM state is up to date, no change to apply')
                return
            raise

        new_osm_timestamp = read_osm_timestamp(ctx, change_file_path)

        osm_update(
            ctx,
            f"postgis://{ctx.pg.user}:{ctx.pg.password}@{ctx.pg.host}:{ctx.pg.port}/{ctx.pg.database}",
            ctx.update_tiles_dir,
            ctx.generated_files_dir,
            ctx.imposm_config_dir,
            change_file_path
        )
        write_new_state(ctx, new_osm_timestamp)
        os.remove(change_file_path)


# default task
############## 
开发者ID:QwantResearch,项目名称:kartotherian_docker,代码行数:37,代码来源:tasks.py

示例9: build_task_factory

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def build_task_factory(ns):
    @curry
    def task_decorator(function, **kwargs):
        name = kwargs.pop("name", None)
        default = kwargs.pop("default", None)
        created_task = task(function, **kwargs)
        ns.add_task(created_task, name=name, default=default)
        return created_task
    return task_decorator 
开发者ID:IvanMalison,项目名称:okcupyd,代码行数:11,代码来源:util.py

示例10: build_copy_task

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def build_copy_task(method):
    @task
    def copy_task(source_credentials, dest_credentials):
        copy = build_copy(source_credentials, dest_credentials)
        getattr(copy, method)()
    ns.add_task(copy_task, name=method) 
开发者ID:IvanMalison,项目名称:okcupyd,代码行数:8,代码来源:copy.py

示例11: clean_all

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def clean_all(ctx, dry_run=False):
    """Clean up everything, even the precious stuff.
    NOTE: clean task is executed first.
    """
    cleanup_dirs(ctx.clean_all.directories or [], dry_run=dry_run)
    cleanup_dirs(ctx.clean_all.extra_directories or [], dry_run=dry_run)
    cleanup_files(ctx.clean_all.files or [], dry_run=dry_run)
    cleanup_files(ctx.clean_all.extra_files or [], dry_run=dry_run)
    execute_cleanup_tasks(ctx, cleanup_all_tasks, dry_run=dry_run)
    clean(ctx, dry_run=dry_run) 
开发者ID:click-contrib,项目名称:click-configfile,代码行数:12,代码来源:clean.py

示例12: watch_docs

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def watch_docs(ctx, browse=False):
    """Run build the docs when a file changes."""
    try:
        import sphinx_autobuild  # noqa
    except ImportError:
        print('ERROR: watch task requires the sphinx_autobuild package.')
        print('Install it with:')
        print('    pip install sphinx-autobuild')
        sys.exit(1)
    ctx.run('sphinx-autobuild {0} {1} {2} -z aiohttp_utils'.format(
        '--open-browser' if browse else '', docs_dir, build_dir), echo=True, pty=True) 
开发者ID:sloria,项目名称:aiohttp-utils,代码行数:13,代码来源:tasks.py

示例13: test

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def test(ctx, unit='', style='', cover=False):
    """ run tests (unit, style)
    """

    if not (unit or style or cover):
        sys.exit('Test task needs --unit, --style or --cover')
    if unit:
        test_unit('.' if not isinstance(unit, str) else unit)
    if style:
        test_style('.' if not isinstance(style, str) else style)
    if cover:
        show_coverage_html() 
开发者ID:flexxui,项目名称:flexx,代码行数:14,代码来源:test.py

示例14: help

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def help(ctx):
    """Get info on usage.
    """

    print('Developer tools for project %s\n' % NAME.capitalize())
    print('  invoke <task> [arg] to run a task')
    print('  invoke --help <task> to get info on a task')
    print()
    subprocess.call('invoke --list') 
开发者ID:flexxui,项目名称:flexx,代码行数:11,代码来源:help.py

示例15: cover

# 需要导入模块: import invoke [as 别名]
# 或者: from invoke import task [as 别名]
def cover(c, pyenv):
    """Run coverage-monitored tests with Pytest after full setup of each provided Pyenv version."""
    # Note that this task will leave a developer in the last specified version of Python
    # run the test suite for all of the provided versions of Python managed by Pyenv
    for current_pyenv in pyenv:
        print("Python version: " + current_pyenv)
        internal_switch(c, current_pyenv)
        # run the test suite and collect coverage information
        internal_cover(c, cover=True) 
开发者ID:GatorEducator,项目名称:gatorgrader,代码行数:11,代码来源:tasks.py


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