Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def subcollection_config_works_with_default_tasks(self):
@task(default=True)
def mytask(c):
assert c.my_key == "value"
# Sets up a task "known as" sub.mytask which may be called as
# just 'sub' due to being default.
sub = Collection("sub", mytask=mytask)
sub.configure({"my_key": "value"})
main = Collection(sub=sub)
# Execute via collection default 'task' name.
Executor(collection=main).execute("sub")
from invoke import Collection
from invocations.testing import test
from invocations.packaging import release
ns = Collection(release, test)
ns.configure({
'packaging': {
'sign': True,
'wheel': True,
},
"extra_directories": [],
"extra_files": [],
},
"clean_all": {
"directories": [".venv*", ".tox", "downloads", "tmp"],
"files": [],
"extra_directories": [],
"extra_files": [],
},
})
# -- SUPPORT ADDITIONAL CLEANUP TASKS (which are called by ``clean`` task)
cleanup_tasks = Collection("cleanup_tasks")
cleanup_tasks.add_task(clean_python)
cleanup_all_tasks = Collection("cleanup_all_tasks")
# -----------------------------------------------------------------------------
# TASK CONFIGURATION HELPERS: Can be used from other task modules
# -----------------------------------------------------------------------------
def config_add_cleanup_dirs(directories):
cleanup_directories = namespace._configuration["clean"]["directories"]
cleanup_directories.extend(directories)
def config_add_cleanup_files(files):
cleanup_files = namespace._configuration["clean"]["files"]
cleanup_files.extend(files)
import invoke
from . import generate
from . import vendoring
ns = invoke.Collection(generate, vendoring)
dependencies_file="TensorFlow_imagenet/environment_gpu.yml",
docker_args=["-v", f"{env_values['data']}:/data"],
wait_for_completion=True,
)
print(run)
remote_collection = Collection("remote")
remote_collection.add_task(submit_images, "images")
remote_collection.add_task(submit_remote, "synthetic")
local_collection = Collection("local")
local_collection.add_task(submit_images_local, "images")
local_collection.add_task(submit_local, "synthetic")
submit_collection = Collection("submit", local_collection, remote_collection)
namespace = Collection("tf_experiment", submit_collection)
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from invoke import Collection
from . import container
from . import collection
from . import ip
from . import module
from . import test
ns = Collection(
container,
collection,
ip,
module,
test,
)
from invoke import Collection
from tasks import docker
from tasks.base import clean, test, lint, publish, fmt, fmt_dry, swagger
ns = Collection()
ns.add_collection(Collection.from_module(docker))
# we want these to be available at the base level
ns.add_task(clean)
ns.add_task(test)
ns.add_task(lint)
ns.add_task(publish)
ns.add_task(fmt)
ns.add_task(fmt_dry)
ns.add_task(swagger)
from invoke import Collection
from tasks import countries
ns = Collection()
ns.add_collection(Collection.from_module(countries))
marvin = os.path.join(MODULEPATH, 'marvin')
wrap = os.path.join(MODULEPATH, 'wrapmarvin')
update_module(ctx, path=marvin, version=version)
update_module(ctx, path=wrap, wrap=True, version=version)
# restart the new marvin
# switch_module(ctx, version=version)
update_uwsgi(ctx, version=version)
print('Marvin version {0} is set up!\n'.format(version))
print('Check for the new Marvin version at the bottom of the Marvin Web main page!')
# print('Please run ...\n stopmarvin \n module switch wrapmarvin '
# 'wrapmarvin/mangawork.marvin_{0} \n startmarvin \n'.format(version))
ns = Collection(clean, deploy, setup_utah)
docs = Collection('docs')
docs.add_task(build_docs, 'build')
docs.add_task(clean_docs, 'clean')
docs.add_task(show_docs, 'show')
ns.add_collection(docs)
updates = Collection('update')
updates.add_task(update_git, 'git')
updates.add_task(update_current, 'current')
updates.add_task(update_module, 'module')
updates.add_task(update_default, 'default')
ns.add_collection(updates)
from . import test
from . import release
# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None
# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_collection(Collection.from_module(cleanup), name="cleanup")
namespace.add_collection(Collection.from_module(test))
namespace.add_collection(Collection.from_module(release))
cleanup.cleanup_tasks.add_task(cleanup.clean_python)
# -- INJECT: clean configuration into this namespace
namespace.configure(cleanup.namespace.configuration())
if sys.platform.startswith("win"):
# -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
from ._compat_shutil import which
run_settings = dict(echo=True, pty=False, shell=which("cmd"))
namespace.configure({"run": run_settings})
else:
namespace.configure({"run": dict(echo=True, pty=True)})