當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。